Decompiled source of SM64Scrap v2.2.1

SM64Scrap.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using LethalLib.Modules;
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("SM64Scrap")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SM64Scrap")]
[assembly: AssemblyTitle("SM64Scrap")]
[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.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 SM64Scrap
{
	[BepInPlugin("SM64Scrap", "SM64 Scrap", "2.2.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "SM64Scrap";

		private const string NAME = "SM64 Scrap";

		private const string VERSION = "2.2.0";

		private ConfigEntry<int> configStarSpawnWeight;

		private ConfigEntry<LevelTypes> configStarMoonSpawns;

		private ConfigEntry<int> configCoinSpawnWeight;

		private ConfigEntry<LevelTypes> configCoinMoonSpawns;

		private ConfigEntry<int> configBlueCoinSpawnWeight;

		private ConfigEntry<LevelTypes> configBlueCoinMoonSpawns;

		private ConfigEntry<int> configRedCoinSpawnWeight;

		private ConfigEntry<LevelTypes> configRedCoinMoonSpawns;

		private ConfigEntry<int> configBlockSpawnWeight;

		private ConfigEntry<LevelTypes> configBlockMoonSpawns;

		private ConfigEntry<int> configMIPSSpawnWeight;

		private ConfigEntry<LevelTypes> configMIPSMoonSpawns;

		private ConfigEntry<int> configBobOmbSpawnWeight;

		private ConfigEntry<LevelTypes> configBobOmbMoonSpawns;

		private ConfigEntry<int> configOneUpSpawnWeight;

		private ConfigEntry<LevelTypes> configOneUpMoonSpawns;

		private ConfigEntry<int> configCapSpawnWeight;

		private ConfigEntry<LevelTypes> configCapMoonSpawns;

		private ConfigEntry<int> configBowserKeySpawnWeight;

		private ConfigEntry<LevelTypes> configBowserKeyMoonSpawns;

		private ConfigEntry<int> configShellSpawnWeight;

		private ConfigEntry<LevelTypes> configShellMoonSpawns;

		private ConfigEntry<int> configSM64PaintingsSpawnWeight;

		private ConfigEntry<LevelTypes> configSM64PaintingsMoonSpawns;

		public static Plugin instance;

		private void Awake()
		{
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_054b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_061a: Unknown result type (might be due to invalid IL or missing references)
			//IL_065f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
			configStarSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Star", "Spawn Weight", 15, "How many Power Stars will appear (higher value = more spawns)");
			configStarMoonSpawns = ((BaseUnityPlugin)this).Config.Bind<LevelTypes>("Star", "Spawn Locations", (LevelTypes)15356, "Choose which moons the Power Star will spawn on");
			configCoinSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Coin", "Spawn Weight", 45, "How many Coins will appear (higher value = more spawns)");
			configCoinMoonSpawns = ((BaseUnityPlugin)this).Config.Bind<LevelTypes>("Coin", "Spawn Locations", (LevelTypes)15356, "Choose which moons Coins will spawn on");
			configBlueCoinSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Blue Coin", "Spawn Weight", 30, "How many Blue Coins will appear (higher value = more spawns)");
			configBlueCoinMoonSpawns = ((BaseUnityPlugin)this).Config.Bind<LevelTypes>("Blue Coin", "Spawn Locations", (LevelTypes)15356, "Choose which moons Blue Coins will spawn on");
			configRedCoinSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Red Coin", "Spawn Weight", 35, "How many Red Coins will appear (higher value = more spawns)");
			configRedCoinMoonSpawns = ((BaseUnityPlugin)this).Config.Bind<LevelTypes>("Red Coin", "Spawn Locations", (LevelTypes)15356, "Choose which moons Red Coins will spawn on");
			configBlockSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Red ? Block", "Spawn Weight", 25, "How many Red ? Blocks will appear (higher value = more spawns)");
			configBlockMoonSpawns = ((BaseUnityPlugin)this).Config.Bind<LevelTypes>("Red ? Block", "Spawn Locations", (LevelTypes)15356, "Choose which moons Red ? Blocks will spawn on");
			configBobOmbSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Bob-Omb", "Spawn Weight", 20, "How many Bob-Ombs will appear (higher value = more spawns)");
			configBobOmbMoonSpawns = ((BaseUnityPlugin)this).Config.Bind<LevelTypes>("Bob-Omb", "Spawn Locations", (LevelTypes)15356, "Choose which moons Bob-Ombs will spawn on");
			configCapSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Marios Cap", "Spawn Weight", 10, "How many of Mario's Cap will appear (higher value = more spawns)");
			configCapMoonSpawns = ((BaseUnityPlugin)this).Config.Bind<LevelTypes>("Marios Cap", "Spawn Locations", (LevelTypes)15356, "Choose which moons Mario's Cap will spawn on");
			configMIPSSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("MIPS", "Spawn Weight", 5, "How many MIPS will appear (higher value = more spawns)");
			configMIPSMoonSpawns = ((BaseUnityPlugin)this).Config.Bind<LevelTypes>("MIPS", "Spawn Locations", (LevelTypes)15356, "Choose which moons MIPS will spawn on");
			configBowserKeySpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Bowser Key", "Spawn Weight", 10, "How many Bowser Keys will appear (higher value = more spawns)");
			configBowserKeyMoonSpawns = ((BaseUnityPlugin)this).Config.Bind<LevelTypes>("Bowser Key", "Spawn Locations", (LevelTypes)15356, "Choose which moons Bowser Keys will spawn on");
			configOneUpSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("1-Up", "Spawn Weight", 32, "How many 1-Up's will appear (higher value = more spawns)");
			configOneUpMoonSpawns = ((BaseUnityPlugin)this).Config.Bind<LevelTypes>("1-Up", "Spawn Locations", (LevelTypes)15356, "Choose which moons 1-Up's will spawn on");
			configShellSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Koopa Shell", "Spawn Weight", 38, "How many Koopa Shells will appear (higher value = more spawns)");
			configShellMoonSpawns = ((BaseUnityPlugin)this).Config.Bind<LevelTypes>("Koopa Shell", "Spawn Locations", (LevelTypes)15356, "Choose which moons Koopa Shells will spawn on");
			configSM64PaintingsSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Paintings", "Spawn Weight", 15, "How many paintings will appear (higher value = more spawns)");
			configSM64PaintingsMoonSpawns = ((BaseUnityPlugin)this).Config.Bind<LevelTypes>("Paintings", "Spawn Locations", (LevelTypes)15356, "Choose which moons paintings will spawn on");
			instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sm64scrap");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Item val2 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Scrap/Star/StarItem.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Utilities.FixMixerGroups(val2.spawnPrefab);
			Items.RegisterScrap(val2, configStarSpawnWeight.Value, configStarMoonSpawns.Value);
			Item val3 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Scrap/Coins/CoinItem.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
			Utilities.FixMixerGroups(val3.spawnPrefab);
			Items.RegisterScrap(val3, configCoinSpawnWeight.Value, configCoinMoonSpawns.Value);
			Item val4 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Scrap/Coins/RedCoinItem.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
			Utilities.FixMixerGroups(val4.spawnPrefab);
			Items.RegisterScrap(val4, configRedCoinSpawnWeight.Value, configRedCoinMoonSpawns.Value);
			Item val5 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Scrap/Coins/BlueCoinItem.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val5.spawnPrefab);
			Utilities.FixMixerGroups(val5.spawnPrefab);
			Items.RegisterScrap(val5, configBlueCoinSpawnWeight.Value, configBlueCoinMoonSpawns.Value);
			Item val6 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Scrap/Shell/ShellItem.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab);
			Utilities.FixMixerGroups(val6.spawnPrefab);
			Items.RegisterScrap(val6, configShellSpawnWeight.Value, configShellMoonSpawns.Value);
			Item val7 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Scrap/Q_Block/QBlockItem.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val7.spawnPrefab);
			Utilities.FixMixerGroups(val7.spawnPrefab);
			Items.RegisterScrap(val7, configBlockSpawnWeight.Value, configBlockMoonSpawns.Value);
			Item val8 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Scrap/bob-omb/BobOmbItem.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val8.spawnPrefab);
			Utilities.FixMixerGroups(val8.spawnPrefab);
			Items.RegisterScrap(val8, configBobOmbSpawnWeight.Value, configBobOmbMoonSpawns.Value);
			Item val9 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Scrap/Cap/CapItem.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val9.spawnPrefab);
			Utilities.FixMixerGroups(val9.spawnPrefab);
			Items.RegisterScrap(val9, configCapSpawnWeight.Value, configCapMoonSpawns.Value);
			Item val10 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Scrap/MIPS/MIPSItem.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val10.spawnPrefab);
			Utilities.FixMixerGroups(val10.spawnPrefab);
			Items.RegisterScrap(val10, configMIPSSpawnWeight.Value, configMIPSMoonSpawns.Value);
			Item val11 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Scrap/1Up/OneUpItem.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val11.spawnPrefab);
			Utilities.FixMixerGroups(val11.spawnPrefab);
			Items.RegisterScrap(val11, configOneUpSpawnWeight.Value, configOneUpMoonSpawns.Value);
			Item val12 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Scrap/BowserKey/BowserKeyItem.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val12.spawnPrefab);
			Utilities.FixMixerGroups(val12.spawnPrefab);
			Items.RegisterScrap(val12, configBowserKeySpawnWeight.Value, configBowserKeyMoonSpawns.Value);
			Item val13 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Scrap/Paintings/FancyPaintingSM64.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val13.spawnPrefab);
			Utilities.FixMixerGroups(val13.spawnPrefab);
			Items.RegisterScrap(val13, configSM64PaintingsSpawnWeight.Value, configSM64PaintingsMoonSpawns.Value);
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "SM64Scrap");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded SM64 Scrap");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SM64Scrap";

		public const string PLUGIN_NAME = "SM64Scrap";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace SM64Scrap.Patches
{
	[HarmonyPatch(typeof(TVScript))]
	public class ExampleTVPatch
	{
		[HarmonyPatch("SwitchTVLocalClient")]
		[HarmonyPrefix]
		private static void SwitchTVPrefix(TVScript __instance)
		{
			StartOfRound.Instance.shipRoomLights.SetShipLightsBoolean(__instance.tvOn);
		}
	}
}