Decompiled source of Sonic Scraps v1.6.1

BepInEx/plugins/ChaoScrap.dll

Decompiled 5 months ago
using System;
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 BepInEx;
using BepInEx.Configuration;
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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("ChaoScrap")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("ChaoScrap")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ChaoScrap")]
[assembly: AssemblyTitle("ChaoScrap")]
[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 ChaoScrap
{
	public static class ConfigSettings
	{
		public static ConfigEntry<int> chaoRarity;

		public static ConfigEntry<int> emeraldRarity;

		public static ConfigEntry<int> tailsRarity;

		public static ConfigEntry<int> ShadowRarity;

		public static void BindConfigSettings()
		{
			chaoRarity = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("SonicScrap", "chaoRarity", 35, "How rare are the Chao scrap - 100 is very common , 1 is very rare .");
			emeraldRarity = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("SonicScrap", "emeraldRarity", 25, "How rare are the Emeralds scrap - 100 is very common , 1 is very rare.");
			tailsRarity = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("SonicScrap", "tailsRarity", 50, "How rare is the Tails scrap - 100 is very common , 1 is very rare.");
			ShadowRarity = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("SonicScrap", "ShadowRarity", 50, "How rare is the Shadow scrap - 100 is very common , 1 is very rare.");
		}
	}
	[BepInPlugin("com.studiocanigou.ChaoScrap", "Chao Scrap", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin instance;

		private void Awake()
		{
			instance = this;
			ConfigSettings.BindConfigSettings();
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sonicscrap");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			List<Item> list = new List<Item>(3)
			{
				val.LoadAsset<Item>("Assets/Scraps/Sonic/Devil Chao/Devil Chao.asset"),
				val.LoadAsset<Item>("Assets/Scraps/Sonic/Angel Chao/Angel Chao.asset"),
				val.LoadAsset<Item>("Assets/Scraps/Sonic/Light Chao/Light Chao.asset")
			};
			List<Item> list2 = new List<Item>(7)
			{
				val.LoadAsset<Item>("Assets/Scraps/Sonic/emerald/Green/GreenEmerald.asset"),
				val.LoadAsset<Item>("Assets/Scraps/Sonic/emerald/Red/RedEmerald.asset"),
				val.LoadAsset<Item>("Assets/Scraps/Sonic/emerald/Blue/BlueEmerald.asset"),
				val.LoadAsset<Item>("Assets/Scraps/Sonic/emerald/Purple/PurpleEmerald.asset"),
				val.LoadAsset<Item>("Assets/Scraps/Sonic/emerald/SkyBlue/SkyBlueEmerald.asset"),
				val.LoadAsset<Item>("Assets/Scraps/Sonic/emerald/White/WhiteEmerald.asset"),
				val.LoadAsset<Item>("Assets/Scraps/Sonic/emerald/Yellow/YellowEmerald.asset")
			};
			Item val2 = val.LoadAsset<Item>("Assets/Scraps/Sonic/tail/Tails.asset");
			Item val3 = val.LoadAsset<Item>("Assets/Scraps/Sonic/Shadow/Shadow.asset");
			foreach (Item item in list)
			{
				NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
			}
			foreach (Item item2 in list2)
			{
				NetworkPrefabs.RegisterNetworkPrefab(item2.spawnPrefab);
			}
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
			foreach (Item item3 in list)
			{
				Utilities.FixMixerGroups(item3.spawnPrefab);
			}
			foreach (Item item4 in list2)
			{
				Utilities.FixMixerGroups(item4.spawnPrefab);
			}
			Utilities.FixMixerGroups(val2.spawnPrefab);
			Utilities.FixMixerGroups(val3.spawnPrefab);
			foreach (Item item5 in list)
			{
				Items.RegisterScrap(item5, ConfigSettings.chaoRarity.Value, (LevelTypes)(-1));
			}
			foreach (Item item6 in list2)
			{
				Items.RegisterScrap(item6, ConfigSettings.emeraldRarity.Value, (LevelTypes)(-1));
			}
			Items.RegisterScrap(val2, ConfigSettings.tailsRarity.Value, (LevelTypes)(-1));
			Items.RegisterScrap(val3, ConfigSettings.ShadowRarity.Value, (LevelTypes)(-1));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Sonic Scrap is loaded! ");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ChaoScrap";

		public const string PLUGIN_NAME = "ChaoScrap";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}