Decompiled source of ColorfulJarOfPickles v1.0.6

ColorfulJarOfPickles.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using ColorfulJarOfPickles.Utils;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using StaticNetcodeLib;
using Unity.Netcode;
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("ColorfulJarOfPickles")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("ColorfulJarOfPickles")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0802eb453fa59697408fd622679c7bead25f07fe")]
[assembly: AssemblyProduct("ColorfulJarOfPickles")]
[assembly: AssemblyTitle("ColorfulJarOfPickles")]
[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 ColorfulJarOfPickles
{
	[BepInPlugin("wexop.colorful_jar_of_pickles", "ColorfulJarOfPickles", "1.0.6")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ColorfulJarOfPicklesPlugin : BaseUnityPlugin
	{
		private const string GUID = "wexop.colorful_jar_of_pickles";

		private const string NAME = "ColorfulJarOfPickles";

		private const string VERSION = "1.0.6";

		public static ColorfulJarOfPicklesPlugin instance;

		public ConfigEntry<string> spawnMoonRarity;

		public ConfigEntry<string> bigJarSpawnMoonRarity;

		public ConfigEntry<string> smallJarSpawnMoonRarity;

		public ConfigEntry<string> longJarSpawnMoonRarity;

		public ConfigEntry<string> flatJarSpawnMoonRarity;

		public ConfigEntry<string> stackSmallJarSpawnMoonRarity;

		public ConfigEntry<string> roundJarSpawnMoonRarity;

		public ConfigEntry<string> caseOfPicklesRarity;

		public ConfigEntry<string> caseOfSmallPicklesRarity;

		public ConfigEntry<string> flaskPicklesRarity;

		public ConfigEntry<string> giantPicklesRarity;

		public ConfigEntry<string> dancingPicklesRarity;

		public ConfigEntry<string> rainbowSmallJarSpawnMoonRarity;

		public ConfigEntry<string> rainbowBigJarSpawnMoonRarity;

		public ConfigEntry<string> rainbowSpawnMoonRarity;

		public ConfigEntry<string> rainbowLongJarSpawnMoonRarity;

		public ConfigEntry<string> rainbowFlatJarSpawnMoonRarity;

		public ConfigEntry<string> rainbowStackSmallJarSpawnMoonRarity;

		public ConfigEntry<string> rainbowRoundJarSpawnMoonRarity;

		public ConfigEntry<string> rainbowCaseOfPicklesRarity;

		public ConfigEntry<string> rainbowCaseOfSmallPicklesRarity;

		public ConfigEntry<string> rainbowFlaskPicklesRarity;

		public ConfigEntry<string> rainbowGiantPicklesRarity;

		public ConfigEntry<string> rainbowDancingPicklesRarity;

		public ConfigEntry<float> dancingMusicVolume;

		private void Awake()
		{
			instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ColorfulJarOfPickles starting....");
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "colorfuljarofpickles");
			AssetBundle bundle = AssetBundle.LoadFromFile(text);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ColorfulJarOfPickles bundle found !");
			LoadConfigs();
			RegisterScrap(bundle);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ColorfulJarOfPickles is ready!");
		}

		private string RarityString(int rarity)
		{
			return $"Modded:{rarity},ExperimentationLevel:{rarity},AssuranceLevel:{rarity},VowLevel:{rarity},OffenseLevel:{rarity},MarchLevel:{rarity},RendLevel:{rarity},DineLevel:{rarity},TitanLevel:{rarity},Adamance:{rarity},Embrion:{rarity},Artifice:{rarity}";
		}

		private void LoadConfigs()
		{
			spawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "ScrapSpawnRarity", RarityString(40), "Chance for scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(spawnMoonRarity, requireRestart: true);
			bigJarSpawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "BigJarScrapSpawnRarity", RarityString(20), "Chance for big jar scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(bigJarSpawnMoonRarity, requireRestart: true);
			smallJarSpawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "SmallJarScrapSpawnRarity", RarityString(30), "Chance for small jar scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(smallJarSpawnMoonRarity, requireRestart: true);
			longJarSpawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "LongJarSpawnMoonRarity", RarityString(15), "Chance for long jar scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(longJarSpawnMoonRarity, requireRestart: true);
			flatJarSpawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "FlatJarSpawnMoonRarity", RarityString(15), "Chance for flat jar scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(flatJarSpawnMoonRarity, requireRestart: true);
			stackSmallJarSpawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "StackSmallJarSpawnMoonRarity", RarityString(15), "Chance for stack of jars scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(stackSmallJarSpawnMoonRarity, requireRestart: true);
			roundJarSpawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "RoundJarSpawnMoonRarity", RarityString(30), "Chance for round jar scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(roundJarSpawnMoonRarity, requireRestart: true);
			caseOfPicklesRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CaseOfPicklesRarity", RarityString(15), "Chance for case of pickles to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(caseOfPicklesRarity, requireRestart: true);
			caseOfSmallPicklesRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CaseOfSmallPicklesRarity", RarityString(15), "Chance for case of small pickles to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(caseOfSmallPicklesRarity, requireRestart: true);
			flaskPicklesRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "FlaskPicklesRarity", RarityString(30), "Chance for pickles in flask scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(flaskPicklesRarity, requireRestart: true);
			giantPicklesRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "GiantPicklesRarity", RarityString(5), "Chance for giant jar of pickles scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(giantPicklesRarity, requireRestart: true);
			dancingPicklesRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "DancingPicklesRarity", RarityString(10), "Chance for dancing pickles scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(dancingPicklesRarity, requireRestart: true);
			rainbowSmallJarSpawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "RainbowSmallJarScrapSpawnRarity", RarityString(5), "Chance for rainbow small jar scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(rainbowSmallJarSpawnMoonRarity, requireRestart: true);
			rainbowBigJarSpawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "RainbowBigJarScrapSpawnRarity", RarityString(3), "Chance for rainbow big jar scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(rainbowBigJarSpawnMoonRarity, requireRestart: true);
			rainbowSpawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "RainbowScrapSpawnRarity", RarityString(5), "Chance for rainbow scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(rainbowSpawnMoonRarity, requireRestart: true);
			rainbowLongJarSpawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "RainbowLongJarSpawnMoonRarity", RarityString(3), "Chance for rainbow long jar scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(rainbowLongJarSpawnMoonRarity, requireRestart: true);
			rainbowFlatJarSpawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "RainbowFlatJarSpawnMoonRarity", RarityString(3), "Chance for rainbow flat jar scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(rainbowFlatJarSpawnMoonRarity, requireRestart: true);
			rainbowStackSmallJarSpawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "RainbowStackSmallJarSpawnMoonRarity", RarityString(3), "Chance for rainbow stack of jars scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(rainbowStackSmallJarSpawnMoonRarity, requireRestart: true);
			rainbowRoundJarSpawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "RainbowRoundJarSpawnMoonRarity", RarityString(5), "Chance for rainbow round jar scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(rainbowRoundJarSpawnMoonRarity, requireRestart: true);
			rainbowCaseOfSmallPicklesRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "RainbowCaseOfSmallPicklesRarity", RarityString(3), "Chance for rainbow case of small pickles scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(rainbowCaseOfSmallPicklesRarity, requireRestart: true);
			rainbowCaseOfPicklesRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "RainbowCaseOfPicklesRarity", RarityString(3), "Chance for rainbow case of pickles scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(rainbowCaseOfPicklesRarity, requireRestart: true);
			rainbowFlaskPicklesRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "RainbowFlaskPicklesRarity", RarityString(5), "Chance for rainbow pickles in flask scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(rainbowFlaskPicklesRarity, requireRestart: true);
			rainbowGiantPicklesRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "RainbowGiantPicklesRarity", RarityString(1), "Chance for rainbow giant jar of pickles scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(rainbowGiantPicklesRarity, requireRestart: true);
			rainbowDancingPicklesRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "RainbowDancingPicklesRarity", RarityString(1), "Chance for rainbow giant jar of pickles scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(rainbowDancingPicklesRarity, requireRestart: true);
			dancingMusicVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Sound", "DancingMusicVolume", 1f, "Dancing Pickles music volume. You don't need to restart the game.");
			CreateFloatConfig(dancingMusicVolume, 0f, 1f);
		}

		private void RegisterScrap(AssetBundle bundle)
		{
			Item val = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/ColorfulPickleJar.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Utilities.FixMixerGroups(val.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(spawnMoonRarity.Value, val);
			Item val2 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/RainbowPickleJar.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val2).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val2.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Utilities.FixMixerGroups(val2.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(rainbowSpawnMoonRarity.Value, val2);
			Item val3 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/BigPickleJar.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val3).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val3.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
			Utilities.FixMixerGroups(val3.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(bigJarSpawnMoonRarity.Value, val3);
			Item val4 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/SmallPickleJar.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val4).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val4.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
			Utilities.FixMixerGroups(val4.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(smallJarSpawnMoonRarity.Value, val4);
			Item val5 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/LongColorfulPickleJar.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val5).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val5.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val5.spawnPrefab);
			Utilities.FixMixerGroups(val5.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(longJarSpawnMoonRarity.Value, val5);
			Item val6 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/FlatPickleJar.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val6).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val6.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab);
			Utilities.FixMixerGroups(val6.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(flatJarSpawnMoonRarity.Value, val6);
			Item val7 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/StackSmallPickleJars.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val7).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val7.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val7.spawnPrefab);
			Utilities.FixMixerGroups(val7.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(stackSmallJarSpawnMoonRarity.Value, val7);
			Item val8 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/CaseOfPickles.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val8).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val8.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val8.spawnPrefab);
			Utilities.FixMixerGroups(val8.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(caseOfPicklesRarity.Value, val8);
			Item val9 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/CaseOfSmallPickles.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val9).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val9.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val9.spawnPrefab);
			Utilities.FixMixerGroups(val9.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(caseOfSmallPicklesRarity.Value, val9);
			Item val10 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/RoundPickleJar.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val10).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val10.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val10.spawnPrefab);
			Utilities.FixMixerGroups(val10.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(roundJarSpawnMoonRarity.Value, val10);
			Item val11 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/FlaskPickles.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val11).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val11.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val11.spawnPrefab);
			Utilities.FixMixerGroups(val11.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(flaskPicklesRarity.Value, val11);
			Item val12 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/ColorfulPickleJarGiant.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val12).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val12.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val12.spawnPrefab);
			Utilities.FixMixerGroups(val12.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(giantPicklesRarity.Value, val12);
			Item val13 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/DancingPickles.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val13).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val13.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val13.spawnPrefab);
			Utilities.FixMixerGroups(val13.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(dancingPicklesRarity.Value, val13);
			Item val14 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/RainbowSmallPickleJar.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val14).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val14.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val14.spawnPrefab);
			Utilities.FixMixerGroups(val14.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(rainbowSmallJarSpawnMoonRarity.Value, val14);
			Item val15 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/RainbowBigPickleJar.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val15).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val15.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val15.spawnPrefab);
			Utilities.FixMixerGroups(val15.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(rainbowBigJarSpawnMoonRarity.Value, val15);
			Item val16 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/RainbowLongColorfulPickleJar.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val16).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val16.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val16.spawnPrefab);
			Utilities.FixMixerGroups(val16.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(rainbowLongJarSpawnMoonRarity.Value, val16);
			Item val17 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/RainbowFlatPickleJar.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val17).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val17.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val17.spawnPrefab);
			Utilities.FixMixerGroups(val17.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(rainbowFlatJarSpawnMoonRarity.Value, val17);
			Item val18 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/RainbowStackSmallPickleJars.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val18).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val18.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val18.spawnPrefab);
			Utilities.FixMixerGroups(val18.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(rainbowStackSmallJarSpawnMoonRarity.Value, val18);
			Item val19 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/RainbowRoundPickleJar.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val19).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val19.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val19.spawnPrefab);
			Utilities.FixMixerGroups(val19.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(rainbowRoundJarSpawnMoonRarity.Value, val19);
			Item val20 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/CaseOfPicklesRainbow.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val20).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val20.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val20.spawnPrefab);
			Utilities.FixMixerGroups(val20.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(rainbowCaseOfPicklesRarity.Value, val20);
			Item val21 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/CaseOfSmallPicklesRainbow.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val21).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val21.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val21.spawnPrefab);
			Utilities.FixMixerGroups(val21.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(rainbowCaseOfSmallPicklesRarity.Value, val21);
			Item val22 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/FlaskPicklesRainbow.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val22).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val22.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val22.spawnPrefab);
			Utilities.FixMixerGroups(val22.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(rainbowFlaskPicklesRarity.Value, val22);
			Item val23 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/ColorfulPickleJarGiantRainbow.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val23).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val23.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val23.spawnPrefab);
			Utilities.FixMixerGroups(val23.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(rainbowGiantPicklesRarity.Value, val23);
			Item val24 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/DancingPicklesRainbow.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val24).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val24.spawnPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val24.spawnPrefab);
			Utilities.FixMixerGroups(val24.spawnPrefab);
			RegisterUtil.RegisterScrapWithConfig(rainbowDancingPicklesRarity.Value, val24);
		}

		private void CreateFloatConfig(ConfigEntry<float> configEntry, float min = 0f, float max = 100f)
		{
			//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)
			//IL_000e: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			FloatSliderOptions val = new FloatSliderOptions();
			((BaseRangeOptions<float>)val).Min = min;
			((BaseRangeOptions<float>)val).Max = max;
			((BaseOptions)val).RequiresRestart = false;
			FloatSliderConfigItem val2 = new FloatSliderConfigItem(configEntry, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
		}

		private void CreateIntConfig(ConfigEntry<int> configEntry, int min = 0, int max = 100)
		{
			//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)
			//IL_000e: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			IntSliderOptions val = new IntSliderOptions();
			((BaseRangeOptions<int>)val).Min = min;
			((BaseRangeOptions<int>)val).Max = max;
			((BaseOptions)val).RequiresRestart = false;
			IntSliderConfigItem val2 = new IntSliderConfigItem(configEntry, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
		}

		private void CreateStringConfig(ConfigEntry<string> configEntry, bool requireRestart = false)
		{
			//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)
			//IL_0014: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			TextInputFieldConfigItem val = new TextInputFieldConfigItem(configEntry, new TextInputFieldOptions
			{
				RequiresRestart = requireRestart
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ColorfulJarOfPickles";

		public const string PLUGIN_NAME = "ColorfulJarOfPickles";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ColorfulJarOfPickles.Utils
{
	public class RegisterUtil
	{
		public static void RegisterEnemyWithConfig(string configMoonRarity, EnemyType enemy, TerminalNode terminalNode, TerminalKeyword terminalKeyword, float powerLevel, int spawnCount)
		{
			enemy.MaxCount = spawnCount;
			enemy.PowerLevel = powerLevel;
			var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
			Enemies.RegisterEnemy(enemy, dictionary, dictionary2, terminalNode, terminalKeyword);
		}

		public static void RegisterScrapWithConfig(string configMoonRarity, Item scrap)
		{
			var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
			Items.RegisterScrap(scrap, dictionary, dictionary2);
		}

		public static void RegisterShopItemWithConfig(bool enabledScrap, Item item, TerminalNode terminalNode, int itemCost, string configMoonRarity)
		{
			Items.RegisterShopItem(item, (TerminalNode)null, (TerminalNode)null, terminalNode, itemCost);
			if (enabledScrap)
			{
				RegisterScrapWithConfig(configMoonRarity, item);
			}
		}

		public static (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity)
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
			foreach (string item in from s in configMoonRarity.Split(',')
				select s.Trim())
			{
				string[] array = item.Split(':');
				if (array.Length != 2)
				{
					continue;
				}
				string text = array[0];
				if (!int.TryParse(array[1], out var result))
				{
					continue;
				}
				if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2))
				{
					dictionary[result2] = result;
					continue;
				}
				string value = text + "Level";
				if (Enum.TryParse<LevelTypes>(value, ignoreCase: true, out result2))
				{
					dictionary[result2] = result;
				}
				else
				{
					dictionary2[text] = result;
				}
			}
			return (dictionary, dictionary2);
		}
	}
}
namespace ColorfulJarOfPickles.Scripts
{
	public class ColorfulJarOfPicklesScrap : PhysicsProp
	{
		public GameObject jarGameObject;

		public List<GameObject> picklesGameObjects;

		public Light lightObject;

		public List<Renderer> jarRenderers;

		public Color actualColor;

		public virtual void TriggerDance(bool dance)
		{
		}

		public void ChangeColor(Color color)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			lightObject.color = color;
			jarRenderers.ForEach(delegate(Renderer r)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				r.material.color = SetColorAlpha(color, r.material.color.a);
				if (((Object)r.material).name.Contains("Pickle"))
				{
					r.material.SetColor("_EmissiveColor", color);
				}
			});
			actualColor = color;
		}

		public float RandomZeroToOne()
		{
			return Random.Range(0f, 1f);
		}

		public float RandomLightColorFloat()
		{
			return Random.Range(0.75f, 1f);
		}

		public Color SetColorAlpha(Color color, float alpha)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			return new Color(((Color)(ref color))[0], ((Color)(ref color))[1], ((Color)(ref color))[2], alpha);
		}

		public Color GetRandomColor(float initialAlpha = 1f)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			Color result = default(Color);
			((Color)(ref result))..ctor(RandomZeroToOne(), RandomZeroToOne(), RandomZeroToOne(), initialAlpha);
			((Color)(ref result))[Random.Range(0, 4)] = RandomLightColorFloat();
			return result;
		}

		public override void Start()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Start();
			picklesGameObjects.ForEach(delegate(GameObject p)
			{
				jarRenderers.Add(p.GetComponent<Renderer>());
			});
			List<Renderer> list = jarGameObject.GetComponents<Renderer>().ToList();
			list.ForEach(delegate(Renderer o)
			{
				if (((Object)o.material).name.Contains("JarGlass"))
				{
					jarRenderers.Add(o);
				}
			});
			ChangeColor(GetRandomColor());
			if (((NetworkBehaviour)this).IsServer)
			{
				((MonoBehaviour)this).StartCoroutine(ChangeColorCoroutine());
			}
			else
			{
				((MonoBehaviour)this).StartCoroutine(AskColorCoroutine());
			}
		}

		public IEnumerator ChangeColorCoroutine()
		{
			yield return (object)new WaitForSeconds(0.5f);
			NetworkColorfulJar.ChangeJarColorClientRpc(((NetworkBehaviour)this).NetworkObjectId, GetRandomColor());
		}

		public IEnumerator AskColorCoroutine()
		{
			yield return (object)new WaitForSeconds(1f);
			NetworkColorfulJar.AskColorServerRpc(((NetworkBehaviour)this).NetworkObjectId);
		}
	}
	public class DancingJarOfPickles : ColorfulJarOfPicklesScrap
	{
		private static readonly int Playing = Animator.StringToHash("playing");

		public Animator animator;

		public AudioClip happySong;

		public AudioSource audioSource;

		private bool isPlaying;

		public IEnumerator onPlayingSong()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => !audioSource.isPlaying));
			isPlaying = false;
			animator.SetBool(Playing, false);
		}

		public override void TriggerDance(bool dance)
		{
			animator.SetBool(Playing, dance);
			if (dance)
			{
				audioSource.volume = ColorfulJarOfPicklesPlugin.instance.dancingMusicVolume.Value;
				audioSource.PlayOneShot(happySong);
			}
			else if (audioSource.isPlaying)
			{
				audioSource.Stop();
			}
			((MonoBehaviour)this).StartCoroutine(onPlayingSong());
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			isPlaying = !isPlaying;
			NetworkColorfulJar.DancePicklesServerRpc(((NetworkBehaviour)this).NetworkObjectId, isPlaying);
		}
	}
	[StaticNetcode]
	public class NetworkColorfulJar
	{
		private static ColorfulJarOfPicklesScrap GetPickles(ulong NetworkId)
		{
			List<ColorfulJarOfPicklesScrap> list = Object.FindObjectsByType<ColorfulJarOfPicklesScrap>((FindObjectsSortMode)0).ToList();
			ColorfulJarOfPicklesScrap colorfulJarOfPicklesScrap = null;
			foreach (ColorfulJarOfPicklesScrap item in list)
			{
				if (((NetworkBehaviour)item).NetworkObjectId == NetworkId)
				{
					colorfulJarOfPicklesScrap = item;
				}
			}
			if ((Object)(object)colorfulJarOfPicklesScrap == (Object)null)
			{
				Debug.LogError((object)$"ColorfulJarOfPickles not found, network id : {NetworkId}");
			}
			return colorfulJarOfPicklesScrap;
		}

		[ServerRpc]
		public static void AskColorServerRpc(ulong networkId)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			ColorfulJarOfPicklesScrap pickles = GetPickles(networkId);
			ChangeJarColorClientRpc(networkId, pickles.actualColor);
		}

		[ClientRpc]
		public static void ChangeJarColorClientRpc(ulong networkId, Color color)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			ColorfulJarOfPicklesScrap pickles = GetPickles(networkId);
			if ((Object)(object)pickles != (Object)null)
			{
				Debug.Log((object)$"COLOR CHANGE {networkId} SET VALUE {color}");
				pickles.ChangeColor(color);
			}
		}

		[ServerRpc]
		public static void DancePicklesServerRpc(ulong networkId, bool danse)
		{
			DancePicklesClientRpc(networkId, danse);
		}

		[ClientRpc]
		public static void DancePicklesClientRpc(ulong networkId, bool dance)
		{
			ColorfulJarOfPicklesScrap pickles = GetPickles(networkId);
			if ((Object)(object)pickles != (Object)null)
			{
				pickles.TriggerDance(dance);
			}
		}
	}
	public class RainbowColorfulJarOfPickles : ColorfulJarOfPicklesScrap
	{
		private Color nextColor;

		private float lightSpeed = 1.5f;

		private float lightSpeedTimer;

		private Color lastColorSaved;

		public override void Start()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			base.Start();
			lastColorSaved = GetRandomColor();
			nextColor = GetRandomColor();
		}

		public override void Update()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			lightSpeedTimer += Time.deltaTime;
			if (lightSpeedTimer >= lightSpeed)
			{
				lightSpeedTimer = 0f;
				lastColorSaved = nextColor;
				nextColor = GetRandomColor();
			}
			ChangeColor(Color.Lerp(lastColorSaved, nextColor, Mathf.Clamp(lightSpeedTimer / lightSpeed, 0f, 1f)));
		}
	}
	public class RainbowDancingJarOfPickles : RainbowColorfulJarOfPickles
	{
		private static readonly int Playing = Animator.StringToHash("playing");

		public Animator animator;

		public AudioClip happySong;

		public AudioSource audioSource;

		private bool isPlaying;

		public IEnumerator onPlayingSong()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => !audioSource.isPlaying));
			isPlaying = false;
			animator.SetBool(Playing, false);
		}

		public override void TriggerDance(bool dance)
		{
			animator.SetBool(Playing, dance);
			if (dance)
			{
				audioSource.volume = ColorfulJarOfPicklesPlugin.instance.dancingMusicVolume.Value;
				audioSource.PlayOneShot(happySong);
			}
			else if (audioSource.isPlaying)
			{
				audioSource.Stop();
			}
			((MonoBehaviour)this).StartCoroutine(onPlayingSong());
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			isPlaying = !isPlaying;
			NetworkColorfulJar.DancePicklesServerRpc(((NetworkBehaviour)this).NetworkObjectId, isPlaying);
		}
	}
}