Decompiled source of Bozoros v2.0.3

BepInEx/plugins/Bozoros.dll

Decompiled a month ago
using 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.Configuration;
using BepInEx.Logging;
using Bozoros.Patches;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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: AssemblyCompany("Bozoros")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Plugin for LethalMatt's Bozoros, adds configuration and some additional stuff.")]
[assembly: AssemblyFileVersion("2.0.3.0")]
[assembly: AssemblyInformationalVersion("2.0.3")]
[assembly: AssemblyProduct("Bozoros")]
[assembly: AssemblyTitle("Bozoros")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.3.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 Bozoros
{
	public class Config
	{
		public ConfigEntry<bool> STREAMER_FRIENDLY { get; private set; }

		public ConfigEntry<float> FIREWORK_PARTICLES { get; private set; }

		public ConfigEntry<float> CONFETTI_PARTICLES { get; private set; }

		public ConfigEntry<float> BALLOON_PARTICLES { get; private set; }

		public ConfigEntry<float> FIREWORK_MUSIC_VOLUME { get; private set; }

		public ConfigEntry<float> FIREWORK_EXPLOSION_VOLUME { get; private set; }

		public ConfigEntry<float> ANNOUNCER_VOLUME { get; private set; }

		public ConfigEntry<float> TENT_MUSIC_VOLUME { get; private set; }

		public ConfigEntry<string> GOOFY_PUFFER_NAMES { get; private set; }

		public ConfigEntry<string> CLOWN_GIANT_NAMES { get; private set; }

		public Config(ConfigFile cfg)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Expected O, but got Unknown
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Expected O, but got Unknown
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Expected O, but got Unknown
			cfg.SaveOnConfigSet = false;
			STREAMER_FRIENDLY = cfg.Bind<bool>("General", "StreamerFriendly", true, "Whether the music is streamer-friendly or not.");
			FIREWORK_PARTICLES = cfg.Bind<float>("Particles", "FireworkParticles", 1f, new ConfigDescription("Intensity of firework particles at the end of a clear day.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			CONFETTI_PARTICLES = cfg.Bind<float>("Particles", "ConfettiParticles", 1f, new ConfigDescription("Intensity of confetti particles during eclipsed weather.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			BALLOON_PARTICLES = cfg.Bind<float>("Particles", "BalloonParticles", 1f, new ConfigDescription("Intensity of balloon particles during stormy weather.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FIREWORK_MUSIC_VOLUME = cfg.Bind<float>("Volume", "FireworkMusicVolume", 0.5f, new ConfigDescription("Volume level for the firework music at the end of a clear day.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FIREWORK_EXPLOSION_VOLUME = cfg.Bind<float>("Volume", "FireworkExplosionVolume", 0.5f, new ConfigDescription("Volume level for the firework explosion sound effects at the end of a clear day.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			ANNOUNCER_VOLUME = cfg.Bind<float>("Volume", "AnnouncerVolume", 0.5f, new ConfigDescription("Volume level for the announcer voice at the end of each day.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			TENT_MUSIC_VOLUME = cfg.Bind<float>("Volume", "TentMusicVolume", 0.5f, new ConfigDescription("Volume level for the circus tent music near every entrance.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			GOOFY_PUFFER_NAMES = cfg.Bind<string>("Enemies", "GoofyPufferNames", "Steve,Krusty,Ronald,Arthur,Toodles,Jingles,Dusty,Dumbo,Bingo,Whistle,Mittens,Pancake,Freckles,Chester,Oddball,Snuggles,Charlie,Bashful,Flower,Jumbo,Jimbo,Snickers,Pogo,Giggles,Loofy,Blinky,Ruffles,Dinky,Beebo", "A comma-separated list of names for Spore Lizard enemy variants to show in their scan node (when in Bozoros). Requires restart.");
			CLOWN_GIANT_NAMES = cfg.Bind<string>("Enemies", "ClownGiantNames", "Penn,Teller,Houdini,Dante,Copperfield,Blaine,Angel,Borden,Angier,Merlin,Kaito,Oz,Zatara,Mysterio,Riddler,Eisenheim,Gallico,Splendini", "A comma-separated list of names for Forest Giant enemy variants to show in their scan node (when in Bozoros). Requires restart.");
			ClearOrphanedEntries(cfg);
			cfg.SaveOnConfigSet = true;
			cfg.Save();
		}

		private void ClearOrphanedEntries(ConfigFile config)
		{
			PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
			((Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(config))?.Clear();
		}
	}
	[BepInPlugin("LethalMatt.Bozoros", "BozorosPlugin", "2.0.3")]
	public class Plugin : BaseUnityPlugin
	{
		internal const string GUID = "LethalMatt.Bozoros";

		internal const string PLUGIN_NAME = "BozorosPlugin";

		internal const string VERSION = "2.0.3";

		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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			StaticLogger = ((BaseUnityPlugin)this).Logger;
			try
			{
				Settings = new Config(((BaseUnityPlugin)this).Config);
				Harmony = new Harmony("LethalMatt.Bozoros");
				Harmony.PatchAll(typeof(LoadPatch));
				Harmony.PatchAll(typeof(LeavePatch));
				Harmony.PatchAll(typeof(ClownGiantPatch));
				Harmony.PatchAll(typeof(GoofyPufferPatch));
				StaticLogger.LogInfo((object)"'BozorosPlugin' loaded!");
			}
			catch (Exception arg)
			{
				StaticLogger.LogError((object)string.Format("Error while initializing '{0}': {1}", "BozorosPlugin", arg));
			}
		}
	}
}
namespace Bozoros.Patches
{
	[HarmonyPatch(typeof(ForestGiantAI), "Start")]
	internal class ClownGiantPatch
	{
		[HarmonyPostfix]
		private static void RenameClownGiant(ForestGiantAI __instance)
		{
			if (LoadPatch.OnBozoros && LoadPatch.Random != null && LoadPatch.GoofyPufferNames.Count != 0)
			{
				Transform child = ((Component)__instance).transform.GetChild(1);
				ScanNodeProperties val = default(ScanNodeProperties);
				if (child != null && ((Component)child).TryGetComponent<ScanNodeProperties>(ref val))
				{
					val.headerText = LoadPatch.ClownGiantNames[LoadPatch.Random.Next(0, LoadPatch.ClownGiantNames.Count)] ?? "";
					val.subText = "Clown Giant";
				}
			}
		}
	}
	[HarmonyPatch(typeof(PufferAI), "Start")]
	internal class GoofyPufferPatch
	{
		[HarmonyPostfix]
		private static void RenameGoofyPuffer(PufferAI __instance)
		{
			if (LoadPatch.OnBozoros && LoadPatch.Random != null && LoadPatch.GoofyPufferNames.Count != 0)
			{
				Transform child = ((Component)__instance).transform.GetChild(1);
				ScanNodeProperties val = default(ScanNodeProperties);
				if (child != null && ((Component)child).TryGetComponent<ScanNodeProperties>(ref val))
				{
					val.headerText = LoadPatch.GoofyPufferNames[LoadPatch.Random.Next(0, LoadPatch.GoofyPufferNames.Count)] ?? "";
					val.subText = "Goofy Puffer";
				}
			}
		}
	}
	public class LeavePatch
	{
		[HarmonyPatch(typeof(StartOfRound), "ShipLeave")]
		[HarmonyPostfix]
		private static void ShipLeavePost(SelectableLevel ___currentLevel)
		{
			if (LoadPatch.OnBozoros)
			{
				SoundManager.Instance.currentLevelAmbience = null;
			}
		}
	}
	public class LoadPatch
	{
		public static Random? Random { get; private set; }

		public static List<string> GoofyPufferNames { get; private set; } = new List<string>();


		public static List<string> ClownGiantNames { get; private set; } = new List<string>();


		public static bool OnBozoros { get; private set; } = false;


		[HarmonyPatch(typeof(RoundManager), "FinishGeneratingLevel")]
		[HarmonyPostfix]
		private static void FinishGeneratingLevelPost(StartOfRound ___playersManager, SelectableLevel ___currentLevel)
		{
			if (string.CompareOrdinal(___currentLevel.PlanetName, "823 Bozoros") != 0)
			{
				OnBozoros = false;
				return;
			}
			if (Random == null && Plugin.Settings != null)
			{
				if (Plugin.Settings.GOOFY_PUFFER_NAMES.Value.Length > 0)
				{
					List<string> list = new List<string>();
					string[] array = Plugin.Settings.GOOFY_PUFFER_NAMES.Value.Split(',');
					foreach (string item in array)
					{
						list.Add(item);
					}
					GoofyPufferNames = list;
				}
				if (Plugin.Settings.CLOWN_GIANT_NAMES.Value.Length > 0)
				{
					List<string> list2 = new List<string>();
					string[] array2 = Plugin.Settings.CLOWN_GIANT_NAMES.Value.Split(',');
					foreach (string item in array2)
					{
						list2.Add(item);
					}
					ClownGiantNames = list2;
				}
			}
			Random = new Random(___playersManager.randomMapSeed);
			OnBozoros = true;
		}
	}
}
namespace Bozoros.Behaviours
{
	[Serializable]
	public class ChangeSettings : MonoBehaviour
	{
		public List<AudioSource> fireworkMusicVolume = new List<AudioSource>();

		public List<AudioSource> fireworkExplosionVolume = new List<AudioSource>();

		public List<AudioSource> announcerVolume = new List<AudioSource>();

		public List<AudioSource> tentMusicVolume = new List<AudioSource>();

		public List<ParticleSystem> fireworkParticles = new List<ParticleSystem>();

		public List<ParticleSystem> confettiParticles = new List<ParticleSystem>();

		public List<ParticleSystem> balloonParticles = new List<ParticleSystem>();

		public AudioClip? fireworkMusicCopyrighted;

		private void Awake()
		{
			ApplyVolume(Plugin.Settings?.FIREWORK_MUSIC_VOLUME.Value, fireworkMusicVolume);
			ApplyVolume(Plugin.Settings?.FIREWORK_EXPLOSION_VOLUME.Value, fireworkExplosionVolume);
			ApplyVolume(Plugin.Settings?.ANNOUNCER_VOLUME.Value, announcerVolume);
			ApplyVolume(Plugin.Settings?.TENT_MUSIC_VOLUME.Value, tentMusicVolume);
			ApplyParticleAmount(Plugin.Settings?.FIREWORK_PARTICLES.Value, fireworkParticles);
			ApplyParticleAmount(Plugin.Settings?.CONFETTI_PARTICLES.Value, confettiParticles);
			ApplyParticleAmount(Plugin.Settings?.BALLOON_PARTICLES.Value, balloonParticles);
			if ((Object)(object)fireworkMusicVolume?[0] != (Object)null)
			{
				Config? settings = Plugin.Settings;
				if (settings != null && !settings.STREAMER_FRIENDLY.Value)
				{
					fireworkMusicVolume[0].clip = fireworkMusicCopyrighted;
				}
			}
		}

		private void ApplyVolume(float? value, List<AudioSource> audioSources)
		{
			CollectionExtensions.Do<AudioSource>((IEnumerable<AudioSource>)audioSources, (Action<AudioSource>)delegate(AudioSource source)
			{
				source.volume *= (value * 2f) ?? 1f;
			});
		}

		private void ApplyParticleAmount(float? value, List<ParticleSystem> particleSystems)
		{
			CollectionExtensions.Do<ParticleSystem>((IEnumerable<ParticleSystem>)particleSystems, (Action<ParticleSystem>)delegate(ParticleSystem particle)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				MainModule main = particle.main;
				((MainModule)(ref main)).maxParticles = ((MainModule)(ref main)).maxParticles * (((int?)value) ?? 1);
				particle.Emit(0);
			});
		}
	}
}

BepInEx/plugins/BozorosEnemyVariants.dll

Decompiled a month ago
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using AntlerShed.EnemySkinKit.Vanilla;
using AntlerShed.SkinRegistry;
using BepInEx;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[CompilerGenerated]
[EditorBrowsable(EditorBrowsableState.Never)]
[GeneratedCode("Unity.MonoScriptGenerator.MonoScriptInfoGenerator", null)]
internal class UnitySourceGeneratedAssemblyMonoScriptTypes_v1
{
	private struct MonoScriptData
	{
		public byte[] FilePathsData;

		public byte[] TypesData;

		public int TotalTypes;

		public int TotalFiles;

		public bool IsEditorOnly;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static MonoScriptData Get()
	{
		MonoScriptData result = default(MonoScriptData);
		result.FilePathsData = new byte[102]
		{
			0, 0, 0, 1, 0, 0, 0, 94, 92, 65,
			115, 115, 101, 116, 115, 92, 66, 111, 122, 111,
			114, 111, 115, 69, 110, 101, 109, 121, 86, 97,
			114, 105, 97, 110, 116, 115, 83, 116, 97, 103,
			105, 110, 103, 92, 112, 108, 117, 103, 105, 110,
			115, 92, 66, 111, 122, 111, 114, 111, 115, 69,
			110, 101, 109, 121, 86, 97, 114, 105, 97, 110,
			116, 115, 92, 66, 111, 122, 111, 114, 111, 115,
			69, 110, 101, 109, 121, 86, 97, 114, 105, 97,
			110, 116, 115, 80, 108, 117, 103, 105, 110, 46,
			99, 115
		};
		result.TypesData = new byte[77]
		{
			0, 0, 0, 0, 72, 76, 101, 116, 104, 97,
			108, 77, 97, 116, 116, 46, 76, 101, 116, 104,
			97, 108, 67, 111, 109, 112, 97, 110, 121, 46,
			66, 111, 122, 111, 114, 111, 115, 69, 110, 101,
			109, 121, 86, 97, 114, 105, 97, 110, 116, 115,
			124, 66, 111, 122, 111, 114, 111, 115, 69, 110,
			101, 109, 121, 86, 97, 114, 105, 97, 110, 116,
			115, 80, 108, 117, 103, 105, 110
		};
		result.TotalFiles = 1;
		result.TotalTypes = 1;
		result.IsEditorOnly = false;
		return result;
	}
}
namespace LethalMatt.LethalCompany.BozorosEnemyVariants;

[BepInPlugin("LethalMatt.Bozoros.BozorosEnemyVariants", "BozorosEnemyVariants", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BozorosEnemyVariantsPlugin : BaseUnityPlugin
{
	public const string modGUID = "LethalMatt.Bozoros.BozorosEnemyVariants";

	public const string modName = "BozorosEnemyVariants";

	public const string modVersion = "1.0.0";

	private void Awake()
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "AssetBundles/LethalMatt_BozorosEnemyVariants_SkinAssets"));
		EnemySkinRegistry.RegisterSkin((Skin)(object)val.LoadAsset<ForestKeeperSkin>("Assets/Skins/ClownGiant.asset"), (DefaultSkinConfigData?)new DefaultSkinConfigData((DefaultSkinConfigEntry[])(object)new DefaultSkinConfigEntry[2]
		{
			new DefaultSkinConfigEntry("circus", 1f),
			new DefaultSkinConfigEntry("fun", 1f)
		}, 0f, 0f));
		EnemySkinRegistry.RegisterSkin((Skin)(object)val.LoadAsset<SporeLizardSkin>("Assets/Skins/GoofyPuffer.asset"), (DefaultSkinConfigData?)new DefaultSkinConfigData((DefaultSkinConfigEntry[])(object)new DefaultSkinConfigEntry[2]
		{
			new DefaultSkinConfigEntry("circus", 1f),
			new DefaultSkinConfigEntry("fun", 1f)
		}, 0f, 0f));
	}
}