Decompiled source of BoysClubMegaPack v1.7.4

BoysClubMegaPack.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
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 System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BoysClubMegaPack.Effects;
using BoysClubMegaPack.Suits;
using CSync.Lib;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalLib.Modules;
using LethalNetworkAPI;
using ModelReplacement;
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 = "")]
[assembly: AssemblyCompany("BoysClubMegaPack")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BoysClubMegaPack")]
[assembly: AssemblyTitle("BoysClubMegaPack")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BoysClubMegaPack
{
	public class Scrap
	{
		public string asset;

		public int rarity;

		public int behaviorID;

		public string customName;

		public Scrap(string asset, int rarity, int behaviorID = 0, string customName = "")
		{
			this.asset = "Assets/BoysClubMod/Items/" + asset + ".asset";
			this.rarity = rarity;
			this.behaviorID = behaviorID;
			this.customName = customName;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency("com.sigurd.csync", "5.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("boysclub.boysclubmod", "BoysClubMegaPack", "1.7.4")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "boysclub.boysclubmod";

		private const string NAME = "BoysClubMegaPack";

		private const string VERSION = "1.7.4";

		public static Plugin instance;

		internal static Config Config { get; private set; }

		private void loadItemBehaviour(Item item, int behaviourId)
		{
			if (behaviourId == 1)
			{
				item.spawnPrefab.AddComponent<PCExplosion>().CopyValuesFrom(item.spawnPrefab.GetComponent<NoisemakerProp>());
				Object.Destroy((Object)(object)item.spawnPrefab.GetComponent<NoisemakerProp>());
			}
		}

		private void Awake()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "boysclubmod");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Assets.PopulateAssets();
			ModelReplacementAPI.RegisterSuitModelReplacement("Amy Rose", typeof(MRAMYROSESUITMODEL));
			ModelReplacementAPI.RegisterSuitModelReplacement("Toon Link", typeof(MRTOONLINKSUIT));
			Harmony val2 = new Harmony("com.boysclub.megapacksuits");
			val2.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"BoysClubMegaPack Suits Patched!");
			List<Scrap> list = new List<Scrap>
			{
				new Scrap("ExWItem", 1, 0, "Yucky Yucky"),
				new Scrap("SkyItem", 5),
				new Scrap("TomFuzzySackItem", 5, 0, "Tom Nooks Fuzzy Bell Sack"),
				new Scrap("WarioPlushItem", 5),
				new Scrap("SolStatueItem", 5),
				new Scrap("MattStatueItem", 5),
				new Scrap("AriaStatueItem", 5),
				new Scrap("AmyStatueItem", 5),
				new Scrap("FyreStatueItem", 5),
				new Scrap("ToadStatueItem", 5),
				new Scrap("ToadetteStatueItem", 5),
				new Scrap("VoxelMattyStatueItem", 5),
				new Scrap("MasterSwordItem", 8),
				new Scrap("MonopolyPictureItem", 8, 0, "Mr Monopoly Picture"),
				new Scrap("WizpigItem", 8),
				new Scrap("BnuyItem", 8),
				new Scrap("WarioPCItem", 8, 1, "Warios Gaming PC"),
				new Scrap("MattPlushItem", 10),
				new Scrap("AriaPlushItem", 10),
				new Scrap("VillagerPlushItem", 10),
				new Scrap("PurrBoxItem", 10, 0, "Aria Cube"),
				new Scrap("BellBagItem", 10),
				new Scrap("DrCoomerItem", 10),
				new Scrap("WindWakerItem", 10),
				new Scrap("FroggyChairItem", 10),
				new Scrap("CrystalliteItem", 10),
				new Scrap("ToadsworthTrophyItem", 10),
				new Scrap("ToadetteTrophyItem", 10),
				new Scrap("ToadTrophyItem", 10),
				new Scrap("EggmanTrophyItem", 10),
				new Scrap("VillagerTrophyItem", 10),
				new Scrap("BigTheCatTrophyItem", 10),
				new Scrap("AmyRoseCrunchItem", 10, 0, "Crunchy Rose"),
				new Scrap("AmyRoseLegoItem", 10),
				new Scrap("AmyRoseTrophyItem", 10),
				new Scrap("ToonLinkTrophyItem", 10),
				new Scrap("BottleOCokeItem", 10),
				new Scrap("GontaperItem", 13),
				new Scrap("58FigureItem", 13),
				new Scrap("GuppyFigureItem", 13),
				new Scrap("GontaperFigureItem", 13),
				new Scrap("SpikeFigureItem", 13),
				new Scrap("KatieFigureItem", 13),
				new Scrap("KitimekFigureItem", 13),
				new Scrap("FlowFigureItem", 13),
				new Scrap("DerallFigureItem", 13),
				new Scrap("KiwiFigureItem", 13, 0, "Boggler Figure"),
				new Scrap("GumbyFigureItem", 13),
				new Scrap("CalFigureItem", 13),
				new Scrap("MattFigureItem", 13),
				new Scrap("HaltFigureItem", 13),
				new Scrap("PaulineFigureItem", 13),
				new Scrap("StarterFigureItem", 13),
				new Scrap("SolFigureItem", 13),
				new Scrap("MattyFigureItem", 13),
				new Scrap("BBFigureItem", 13, 0, "Blue Blob Figure"),
				new Scrap("AriaFigureItem", 13),
				new Scrap("CasualAriaFigureItem", 13)
			};
			int num = 0;
			Config = new Config(((BaseUnityPlugin)this).Config, list);
			foreach (Scrap item in list)
			{
				Item val3 = val.LoadAsset<Item>(item.asset);
				if (item.behaviorID != 0)
				{
					loadItemBehaviour(val3, item.behaviorID);
				}
				NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
				Utilities.FixMixerGroups(val3.spawnPrefab);
				int num2 = ((Config.scrapEntries[num].Value >= 0) ? Config.scrapEntries[num].Value : item.rarity);
				Items.RegisterScrap(val3, num2, (LevelTypes)(-1));
				num++;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"BoysClubMegaPack Scrap Patched!");
		}
	}
	public class Config : SyncedConfig2<Config>
	{
		public readonly List<ConfigEntry<int>> scrapEntries = new List<ConfigEntry<int>>();

		public Config(ConfigFile cfg, List<Scrap> scraps)
			: base("boysclub.boysclubmod")
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			//IL_00d0: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			cfg.SaveOnConfigSet = false;
			int num = 0;
			foreach (Scrap scrap in scraps)
			{
				string text = ((scrap.customName != "") ? scrap.customName : Regex.Replace(scrap.asset.Split("/")[3].Replace(".asset", "").Replace("Item", ""), "([A-Z])([a-z]*)", " $1$2").Trim());
				scrapEntries.Add(cfg.Bind<int>(new ConfigDefinition("Scrap Spawn Rate", text), scrap.rarity, new ConfigDescription("The weighted rarity of the " + text + " scrap!", (AcceptableValueBase)null, Array.Empty<object>())));
				LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(scrapEntries[num]));
				num++;
			}
			LethalConfigManager.SkipAutoGenFor("Scrap Spawn Rate");
			cfg.Save();
			cfg.SaveOnConfigSet = true;
			ConfigManager.Register<Config>((SyncedConfig2<Config>)this);
		}
	}
	public static class Assets
	{
		public static AssetBundle MainAssetBundle;

		public static void PopulateAssets()
		{
			if ((Object)(object)MainAssetBundle == (Object)null)
			{
				string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "boysclubmegapacksuits");
				MainAssetBundle = AssetBundle.LoadFromFile(text);
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BoysClubMegaPack";

		public const string PLUGIN_NAME = "BoysClubMegaPack";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace BoysClubMegaPack.Suits
{
	public class MRAMYROSESUITMODEL : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			return Assets.MainAssetBundle.LoadAsset<GameObject>("AmyRoseSuitModel");
		}
	}
	public class MRTOONLINKSUIT : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			return Assets.MainAssetBundle.LoadAsset<GameObject>("ToonLinkSuit");
		}
	}
}
namespace BoysClubMegaPack.Effects
{
	internal class PCExplosion : NoisemakerProp
	{
		public LethalClientMessage<Vector3> network;

		private PCExplosion()
		{
			network = new LethalClientMessage<Vector3>("boysclubPCExplosionID", (Action<Vector3>)null, (Action<Vector3, ulong>)null);
			network.OnReceivedFromClient += SpawnExplosionNetwork;
		}

		private void SpawnExplosionNetwork(Vector3 position, ulong clientId)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Landmine.SpawnExplosion(position, true, 5.7f, 6.4f, 50, 1f, (GameObject)null);
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((NoisemakerProp)this).ItemActivate(used, buttonDown);
			if (buttonDown && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((MonoBehaviour)this).StartCoroutine(CountDown());
			}
		}

		public void CopyValuesFrom(NoisemakerProp nm)
		{
			((GrabbableObject)this).grabbable = ((GrabbableObject)nm).grabbable;
			((GrabbableObject)this).grabbableToEnemies = ((GrabbableObject)nm).grabbableToEnemies;
			((GrabbableObject)this).useCooldown = ((GrabbableObject)nm).useCooldown;
			((GrabbableObject)this).itemProperties = ((GrabbableObject)nm).itemProperties;
			base.noiseAudio = nm.noiseAudio;
			base.noiseAudioFar = nm.noiseAudioFar;
			base.noiseRange = nm.noiseRange;
			base.maxLoudness = nm.maxLoudness;
			base.minLoudness = nm.minLoudness;
			base.minPitch = nm.minPitch;
			base.maxPitch = nm.maxPitch;
			base.noiseSFX = (AudioClip[])nm.noiseSFX.Clone();
			Array.Copy(nm.noiseSFX, base.noiseSFX, nm.noiseSFX.Length);
			base.noiseSFXFar = (AudioClip[])nm.noiseSFXFar.Clone();
			Array.Copy(nm.noiseSFXFar, base.noiseSFXFar, nm.noiseSFXFar.Length);
		}

		private IEnumerator CountDown()
		{
			yield return (object)new WaitForSeconds(2.75f);
			network.SendAllClients(((Component)((GrabbableObject)this).playerHeldBy).transform.position, true, false);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}