Decompiled source of ColorfulJarOfPickles v1.0.5

ColorfulJarOfPickles.dll

Decompiled 2 weeks 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+888151e95bb05a71d9a3766e7b1952ff3bf1d05d")]
[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.5")]
	[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.5";

		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> 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;

		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);
			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);
		}

		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/RoundPickleJar.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(roundJarSpawnMoonRarity.Value, val8);
			Item val9 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/RainbowSmallPickleJar.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(rainbowSmallJarSpawnMoonRarity.Value, val9);
			Item val10 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/RainbowBigPickleJar.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(rainbowBigJarSpawnMoonRarity.Value, val10);
			Item val11 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/RainbowLongColorfulPickleJar.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(rainbowLongJarSpawnMoonRarity.Value, val11);
			Item val12 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/RainbowFlatPickleJar.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(rainbowFlatJarSpawnMoonRarity.Value, val12);
			Item val13 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/RainbowStackSmallPickleJars.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(rainbowStackSmallJarSpawnMoonRarity.Value, val13);
			Item val14 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/ColorfulJarOfPickles/RainbowRoundPickleJar.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(rainbowRoundJarSpawnMoonRarity.Value, val14);
		}

		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 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());
			}
		}

		public IEnumerator ChangeColorCoroutine()
		{
			yield return (object)new WaitForSeconds(0.5f);
			NetworkColorfulJar.ChangeJarColorClientRpc(((NetworkBehaviour)this).NetworkObjectId, GetRandomColor());
		}
	}
	[StaticNetcode]
	public class NetworkColorfulJar
	{
		[ClientRpc]
		public static void ChangeJarColorClientRpc(ulong networkId, Color color)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			ColorfulJarOfPicklesScrap[] array = Object.FindObjectsByType<ColorfulJarOfPicklesScrap>((FindObjectsSortMode)0);
			ColorfulJarOfPicklesScrap colorfulJarOfPicklesScrap = null;
			ColorfulJarOfPicklesScrap[] array2 = array;
			foreach (ColorfulJarOfPicklesScrap colorfulJarOfPicklesScrap2 in array2)
			{
				if (((NetworkBehaviour)colorfulJarOfPicklesScrap2).NetworkObjectId == networkId)
				{
					colorfulJarOfPicklesScrap = colorfulJarOfPicklesScrap2;
				}
			}
			if ((Object)(object)colorfulJarOfPicklesScrap != (Object)null)
			{
				Debug.Log((object)$"COLOR CHANGE {networkId} SET VALUE {color}");
				colorfulJarOfPicklesScrap.ChangeColor(color);
			}
		}
	}
	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)));
		}
	}
}