Decompiled source of Brutal Company Reborn v2.1.1

BepInEx/plugins/BrutalCompanyReborn.dll

Decompiled 11 months 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.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BrutalCompanyReborn.Comp.LevelEvents;
using BrutalCompanyReborn.Managers;
using HarmonyLib;
using LC_API.Extensions;
using LC_API.GameInterfaceAPI;
using LC_API.ServerAPI;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("BrutalCompanyReborn")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Brutal Company 2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BrutalCompanyReborn")]
[assembly: AssemblyTitle("BrutalCompanyReborn")]
[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 BrutalCompanyReborn
{
	[BepInPlugin("BrutalCompanyReborn", "BrutalCompanyReborn", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		public static bool BCR_Init;

		public static ConfigEntry<int> cNoneProb;

		public static ConfigEntry<int> cMoneyProb;

		public static ConfigEntry<int> cFakeMoneyProb;

		public static ConfigEntry<int> cTurretProb;

		public static ConfigEntry<int> cLandmineProb;

		public static ConfigEntry<int> cHoardingProb;

		public static ConfigEntry<int> cSnareProb;

		public static ConfigEntry<int> cWorstComboProb;

		public static ConfigEntry<int> cChaosProb;

		public static ConfigEntry<int> cDeliveryProb;

		public static ConfigEntry<int> cUnfairProb;

		public static ConfigEntry<int> cWrongOrderProb;

		public static ConfigEntry<int> cGhostProb;

		public static ConfigEntry<int> cVanillaProb;

		public static ConfigEntry<int> cSeasonalEventProb;

		private void Awake()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			SetUpConfig();
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Brutal Company Reborn, starting up.");
			new Harmony("BCR").PatchAll();
		}

		private void Init()
		{
			if (!BCR_Init)
			{
				BCR_Init = true;
				ManagerBase.CreateManager<PlanetDataHolder>("PlanetDataHolder");
				ManagerBase.CreateManager<PlanetManager>("PlanetManager");
				ManagerBase.CreateManager<QuotaManager>("QuotaManager");
				ManagerBase.CreateManager<PlanetHeatManager>("HeatManager");
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Done creating managers!");
				ModdedServer.SetServerModdedOnly();
			}
		}

		public void Start()
		{
			Init();
		}

		public void OnDestroy()
		{
			Init();
		}

		private void SetUpConfig()
		{
			cNoneProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "No event probability", 4, "Probabilty is a range from 0 - 10");
			cMoneyProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "Free money event probability", 2, "Probabilty is a range from 0 - 10");
			cFakeMoneyProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "Fake Free money event probability", 1, "Probabilty is a range from 0 - 10");
			cTurretProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "Turret hell event probability", 1, "Probabilty is a range from 0 - 10");
			cLandmineProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "Landmine hell event probability", 1, "Probabilty is a range from 0 - 10");
			cHoardingProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "Hoarding town event probability", 3, "Probabilty is a range from 0 - 10");
			cSnareProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "Oops, all snare fleas event probability", 4, "Probabilty is a range from 0 - 10");
			cWorstComboProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "Worst combo event probability", 3, "Probabilty is a range from 0 - 10");
			cChaosProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "Chaos Company event probability", 1, "Probabilty is a range from 0 - 10");
			cDeliveryProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "Delivery event probability", 2, "Probabilty is a range from 0 - 10");
			cUnfairProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "Unfair Company event probability", 1, "Probabilty is a range from 0 - 10");
			cWrongOrderProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "Lost in transit event probability", 3, "Probabilty is a range from 0 - 10");
			cGhostProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "Schizophrenia event probability", 2, "Probabilty is a range from 0 - 10");
			cVanillaProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "Vanilla scaling event probability", 1, "Probabilty is a range from 0 - 10");
			cSeasonalEventProb = ((BaseUnityPlugin)this).Config.Bind<int>("Event Probability", "Seasonal event probability", 4, "Probabilty is a range from 0 - 10");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "BrutalCompanyReborn";

		public const string PLUGIN_NAME = "BrutalCompanyReborn";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace BrutalCompanyReborn.ManualPatches
{
	[HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")]
	internal class Patch_ClientLoad
	{
		private static void Prefix(int randomSeed, int levelID)
		{
			PlanetManager.Instance.ClientEventSetup(levelID);
		}
	}
	[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
	internal class Patch_LoadNewLevel
	{
		private static void Prefix(ref SelectableLevel newLevel)
		{
			PlanetManager.currentLevel = newLevel;
			PlanetManager.Instance.DoEventLogic();
		}
	}
}
namespace BrutalCompanyReborn.Managers
{
	public class ManagerBase : MonoBehaviour
	{
		public string Name;

		public static void CreateManager<T>(string name) where T : ManagerBase
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Object.DontDestroyOnLoad((Object)(object)new GameObject(name).AddComponent<T>());
		}
	}
	internal class PlanetDataHolder : ManagerBase
	{
		public static List<SelectableLevel> levelsOriginal = new List<SelectableLevel>();

		public static List<SelectableLevel> levelsCopy = new List<SelectableLevel>();

		private bool gotLevels;

		public void Start()
		{
		}

		public void Update()
		{
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Expected O, but got Unknown
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Expected O, but got Unknown
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Expected O, but got Unknown
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Expected O, but got Unknown
			//IL_0879: Unknown result type (might be due to invalid IL or missing references)
			//IL_0880: Expected O, but got Unknown
			//IL_0afc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b03: Expected O, but got Unknown
			if (!(((Object)(object)StartOfRound.Instance != (Object)null) & !gotLevels))
			{
				return;
			}
			gotLevels = true;
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel val in levels)
			{
				SelectableLevel val2 = ScriptableObject.CreateInstance<SelectableLevel>();
				val2.planetPrefab = val.planetPrefab;
				val2.sceneName = val.sceneName;
				val2.levelID = val.levelID;
				val2.lockedForDemo = val.lockedForDemo;
				val2.spawnEnemiesAndScrap = val.spawnEnemiesAndScrap;
				val2.PlanetName = val.PlanetName;
				val2.LevelDescription = val.LevelDescription;
				val2.videoReel = val.videoReel;
				val2.riskLevel = val.riskLevel;
				val2.timeToArrive = val.timeToArrive;
				val2.OffsetFromGlobalTime = val.OffsetFromGlobalTime;
				val2.DaySpeedMultiplier = val.DaySpeedMultiplier;
				val2.planetHasTime = val.planetHasTime;
				List<RandomWeatherWithVariables> list = new List<RandomWeatherWithVariables>();
				RandomWeatherWithVariables[] randomWeathers = val.randomWeathers;
				foreach (RandomWeatherWithVariables val3 in randomWeathers)
				{
					RandomWeatherWithVariables val4 = new RandomWeatherWithVariables();
					val4.weatherType = val3.weatherType;
					val4.weatherVariable = val3.weatherVariable;
					val4.weatherVariable2 = val3.weatherVariable2;
					list.Add(val4);
					Plugin.Log.LogWarning((object)("Added weather " + ((object)(LevelWeatherType)(ref val3.weatherType)).ToString() + " to original planet data"));
				}
				val2.randomWeathers = list.ToArray();
				Plugin.Log.LogWarning((object)"Finished cloning weather for original planet data!");
				val2.overrideWeather = val.overrideWeather;
				val2.overrideWeatherType = val.overrideWeatherType;
				val2.currentWeather = val.currentWeather;
				val2.factorySizeMultiplier = val.factorySizeMultiplier;
				List<SpawnableMapObject> list2 = new List<SpawnableMapObject>();
				SpawnableMapObject[] spawnableMapObjects = val.spawnableMapObjects;
				foreach (SpawnableMapObject val5 in spawnableMapObjects)
				{
					SpawnableMapObject val6 = new SpawnableMapObject();
					val6.prefabToSpawn = val5.prefabToSpawn;
					val6.spawnFacingAwayFromWall = val5.spawnFacingAwayFromWall;
					val6.numberToSpawn = val5.numberToSpawn;
					list2.Add(val6);
					Plugin.Log.LogWarning((object)("Added map object " + ((Object)val5.prefabToSpawn).name + " to original planet data"));
				}
				val2.spawnableMapObjects = list2.ToArray();
				Plugin.Log.LogWarning((object)"Finished cloning map objects for original planet data!");
				List<SpawnableOutsideObjectWithRarity> list3 = new List<SpawnableOutsideObjectWithRarity>();
				SpawnableOutsideObjectWithRarity[] spawnableOutsideObjects = val.spawnableOutsideObjects;
				foreach (SpawnableOutsideObjectWithRarity val7 in spawnableOutsideObjects)
				{
					SpawnableOutsideObjectWithRarity val8 = new SpawnableOutsideObjectWithRarity();
					val8.spawnableObject = val7.spawnableObject;
					val8.randomAmount = val7.randomAmount;
					list3.Add(val8);
					Plugin.Log.LogWarning((object)("Added outside map object " + ((Object)val7.spawnableObject.prefabToSpawn).name + " to original planet data"));
				}
				val2.spawnableOutsideObjects = list3.ToArray();
				Plugin.Log.LogWarning((object)"Finished cloning outside map objects for original planet data!");
				List<SpawnableItemWithRarity> list4 = new List<SpawnableItemWithRarity>();
				foreach (SpawnableItemWithRarity item in val.spawnableScrap)
				{
					SpawnableItemWithRarity val9 = new SpawnableItemWithRarity();
					val9.spawnableItem = item.spawnableItem;
					val9.rarity = item.rarity;
					list4.Add(val9);
					Plugin.Log.LogWarning((object)("Added scrap object " + item.spawnableItem.itemName + " to original planet data"));
				}
				val2.spawnableScrap = list4;
				Plugin.Log.LogWarning((object)"Finished cloning scrap objects for original planet data!");
				val2.minScrap = val.minScrap;
				val2.maxScrap = val.maxScrap;
				val2.minTotalScrapValue = val.minTotalScrapValue;
				val2.maxTotalScrapValue = val.maxTotalScrapValue;
				val2.levelAmbienceClips = val.levelAmbienceClips;
				val2.maxEnemyPowerCount = val.maxEnemyPowerCount;
				val2.maxOutsideEnemyPowerCount = val.maxOutsideEnemyPowerCount;
				val2.maxDaytimeEnemyPowerCount = val.maxDaytimeEnemyPowerCount;
				List<SpawnableEnemyWithRarity> list5 = new List<SpawnableEnemyWithRarity>();
				foreach (SpawnableEnemyWithRarity enemy in val.Enemies)
				{
					EnemyType val10 = ScriptableObject.CreateInstance<EnemyType>();
					val10.enemyName = ((Object)enemy.enemyType).name;
					val10.probabilityCurve = enemy.enemyType.probabilityCurve;
					val10.numberSpawnedFalloff = enemy.enemyType.numberSpawnedFalloff;
					val10.enemyPrefab = enemy.enemyType.enemyPrefab;
					val10.PowerLevel = enemy.enemyType.PowerLevel;
					val10.MaxCount = enemy.enemyType.MaxCount;
					val10.numberSpawned = enemy.enemyType.numberSpawned;
					val10.isOutsideEnemy = enemy.enemyType.isOutsideEnemy;
					val10.isDaytimeEnemy = enemy.enemyType.isDaytimeEnemy;
					val10.normalizedTimeInDayToLeave = enemy.enemyType.normalizedTimeInDayToLeave;
					val10.stunTimeMultiplier = enemy.enemyType.stunTimeMultiplier;
					val10.doorSpeedMultiplier = enemy.enemyType.doorSpeedMultiplier;
					val10.stunGameDifficultyMultiplier = enemy.enemyType.stunGameDifficultyMultiplier;
					val10.canBeStunned = enemy.enemyType.canBeStunned;
					val10.canDie = enemy.enemyType.canDie;
					val10.destroyOnDeath = enemy.enemyType.destroyOnDeath;
					val10.canSeeThroughFog = enemy.enemyType.canSeeThroughFog;
					val10.timeToPlayAudio = enemy.enemyType.timeToPlayAudio;
					val10.loudnessMultiplier = enemy.enemyType.loudnessMultiplier;
					val10.overrideVentSFX = enemy.enemyType.overrideVentSFX;
					val10.hitBodySFX = enemy.enemyType.hitBodySFX;
					val10.hitEnemyVoiceSFX = enemy.enemyType.hitEnemyVoiceSFX;
					val10.deathSFX = enemy.enemyType.deathSFX;
					val10.stunSFX = enemy.enemyType.stunSFX;
					val10.audioClips = enemy.enemyType.audioClips;
					SpawnableEnemyWithRarity val11 = new SpawnableEnemyWithRarity();
					val11.enemyType = val10;
					val11.rarity = enemy.rarity;
					list5.Add(val11);
					Plugin.Log.LogWarning((object)("Added enemy " + val11.enemyType.enemyName + " to original planet data"));
				}
				val2.Enemies = list5;
				Plugin.Log.LogWarning((object)"Finished cloning enemies for original planet data!");
				List<SpawnableEnemyWithRarity> list6 = new List<SpawnableEnemyWithRarity>();
				foreach (SpawnableEnemyWithRarity outsideEnemy in val.OutsideEnemies)
				{
					EnemyType val12 = ScriptableObject.CreateInstance<EnemyType>();
					val12.enemyName = ((Object)outsideEnemy.enemyType).name;
					val12.probabilityCurve = outsideEnemy.enemyType.probabilityCurve;
					val12.numberSpawnedFalloff = outsideEnemy.enemyType.numberSpawnedFalloff;
					val12.enemyPrefab = outsideEnemy.enemyType.enemyPrefab;
					val12.PowerLevel = outsideEnemy.enemyType.PowerLevel;
					val12.MaxCount = outsideEnemy.enemyType.MaxCount;
					val12.numberSpawned = outsideEnemy.enemyType.numberSpawned;
					val12.isOutsideEnemy = outsideEnemy.enemyType.isOutsideEnemy;
					val12.isDaytimeEnemy = outsideEnemy.enemyType.isDaytimeEnemy;
					val12.normalizedTimeInDayToLeave = outsideEnemy.enemyType.normalizedTimeInDayToLeave;
					val12.stunTimeMultiplier = outsideEnemy.enemyType.stunTimeMultiplier;
					val12.doorSpeedMultiplier = outsideEnemy.enemyType.doorSpeedMultiplier;
					val12.stunGameDifficultyMultiplier = outsideEnemy.enemyType.stunGameDifficultyMultiplier;
					val12.canBeStunned = outsideEnemy.enemyType.canBeStunned;
					val12.canDie = outsideEnemy.enemyType.canDie;
					val12.destroyOnDeath = outsideEnemy.enemyType.destroyOnDeath;
					val12.canSeeThroughFog = outsideEnemy.enemyType.canSeeThroughFog;
					val12.timeToPlayAudio = outsideEnemy.enemyType.timeToPlayAudio;
					val12.loudnessMultiplier = outsideEnemy.enemyType.loudnessMultiplier;
					val12.overrideVentSFX = outsideEnemy.enemyType.overrideVentSFX;
					val12.hitBodySFX = outsideEnemy.enemyType.hitBodySFX;
					val12.hitEnemyVoiceSFX = outsideEnemy.enemyType.hitEnemyVoiceSFX;
					val12.deathSFX = outsideEnemy.enemyType.deathSFX;
					val12.stunSFX = outsideEnemy.enemyType.stunSFX;
					val12.audioClips = outsideEnemy.enemyType.audioClips;
					SpawnableEnemyWithRarity val13 = new SpawnableEnemyWithRarity();
					val13.enemyType = val12;
					val13.rarity = outsideEnemy.rarity;
					list6.Add(val13);
					Plugin.Log.LogWarning((object)("Added outside enemy " + val13.enemyType.enemyName + " to original planet data"));
				}
				val2.OutsideEnemies = list6;
				Plugin.Log.LogWarning((object)"Finished cloning outside enemies for original planet data!");
				List<SpawnableEnemyWithRarity> list7 = new List<SpawnableEnemyWithRarity>();
				foreach (SpawnableEnemyWithRarity daytimeEnemy in val.DaytimeEnemies)
				{
					EnemyType val14 = ScriptableObject.CreateInstance<EnemyType>();
					val14.enemyName = ((Object)daytimeEnemy.enemyType).name;
					val14.probabilityCurve = daytimeEnemy.enemyType.probabilityCurve;
					val14.numberSpawnedFalloff = daytimeEnemy.enemyType.numberSpawnedFalloff;
					val14.enemyPrefab = daytimeEnemy.enemyType.enemyPrefab;
					val14.PowerLevel = daytimeEnemy.enemyType.PowerLevel;
					val14.MaxCount = daytimeEnemy.enemyType.MaxCount;
					val14.numberSpawned = daytimeEnemy.enemyType.numberSpawned;
					val14.isOutsideEnemy = daytimeEnemy.enemyType.isOutsideEnemy;
					val14.isDaytimeEnemy = daytimeEnemy.enemyType.isDaytimeEnemy;
					val14.normalizedTimeInDayToLeave = daytimeEnemy.enemyType.normalizedTimeInDayToLeave;
					val14.stunTimeMultiplier = daytimeEnemy.enemyType.stunTimeMultiplier;
					val14.doorSpeedMultiplier = daytimeEnemy.enemyType.doorSpeedMultiplier;
					val14.stunGameDifficultyMultiplier = daytimeEnemy.enemyType.stunGameDifficultyMultiplier;
					val14.canBeStunned = daytimeEnemy.enemyType.canBeStunned;
					val14.canDie = daytimeEnemy.enemyType.canDie;
					val14.destroyOnDeath = daytimeEnemy.enemyType.destroyOnDeath;
					val14.canSeeThroughFog = daytimeEnemy.enemyType.canSeeThroughFog;
					val14.timeToPlayAudio = daytimeEnemy.enemyType.timeToPlayAudio;
					val14.loudnessMultiplier = daytimeEnemy.enemyType.loudnessMultiplier;
					val14.overrideVentSFX = daytimeEnemy.enemyType.overrideVentSFX;
					val14.hitBodySFX = daytimeEnemy.enemyType.hitBodySFX;
					val14.hitEnemyVoiceSFX = daytimeEnemy.enemyType.hitEnemyVoiceSFX;
					val14.deathSFX = daytimeEnemy.enemyType.deathSFX;
					val14.stunSFX = daytimeEnemy.enemyType.stunSFX;
					val14.audioClips = daytimeEnemy.enemyType.audioClips;
					SpawnableEnemyWithRarity val15 = new SpawnableEnemyWithRarity();
					val15.enemyType = val14;
					val15.rarity = daytimeEnemy.rarity;
					list7.Add(val15);
					Plugin.Log.LogWarning((object)("Added daytime enemy " + val15.enemyType.enemyName + " to original planet data"));
				}
				val2.DaytimeEnemies = list7;
				Plugin.Log.LogWarning((object)"Finished cloning daytime enemies for original planet data!");
				val2.enemySpawnChanceThroughoutDay = val.enemySpawnChanceThroughoutDay;
				val2.outsideEnemySpawnChanceThroughDay = val.outsideEnemySpawnChanceThroughDay;
				val2.daytimeEnemySpawnChanceThroughDay = val.daytimeEnemySpawnChanceThroughDay;
				val2.spawnProbabilityRange = val.spawnProbabilityRange;
				val2.daytimeEnemiesProbabilityRange = val.daytimeEnemiesProbabilityRange;
				val2.levelIncludesSnowFootprints = val.levelIncludesSnowFootprints;
				levelsOriginal.Add(val2);
				Plugin.Log.LogMessage((object)("Created a shallow copy of level " + val2.PlanetName));
			}
			Plugin.Log.LogMessage((object)"Got all original levels and created a copy for later!");
			PlanetHeatManager.Instance.SetupHeat();
		}

		public static List<SelectableLevel> PopulateAndReturnCloneList()
		{
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Expected O, but got Unknown
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Expected O, but got Unknown
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Expected O, but got Unknown
			//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05eb: Expected O, but got Unknown
			//IL_0867: Unknown result type (might be due to invalid IL or missing references)
			//IL_086e: Expected O, but got Unknown
			//IL_0aea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af1: Expected O, but got Unknown
			int num = 0;
			foreach (SelectableLevel item in levelsOriginal)
			{
				SelectableLevel val = ScriptableObject.CreateInstance<SelectableLevel>();
				val.planetPrefab = item.planetPrefab;
				val.sceneName = item.sceneName;
				val.levelID = item.levelID;
				val.lockedForDemo = item.lockedForDemo;
				val.spawnEnemiesAndScrap = item.spawnEnemiesAndScrap;
				val.PlanetName = item.PlanetName;
				val.LevelDescription = item.LevelDescription;
				val.videoReel = item.videoReel;
				val.riskLevel = item.riskLevel;
				val.timeToArrive = item.timeToArrive;
				val.OffsetFromGlobalTime = item.OffsetFromGlobalTime;
				val.DaySpeedMultiplier = item.DaySpeedMultiplier;
				val.planetHasTime = item.planetHasTime;
				List<RandomWeatherWithVariables> list = new List<RandomWeatherWithVariables>();
				RandomWeatherWithVariables[] randomWeathers = item.randomWeathers;
				foreach (RandomWeatherWithVariables val2 in randomWeathers)
				{
					RandomWeatherWithVariables val3 = new RandomWeatherWithVariables();
					val3.weatherType = val2.weatherType;
					val3.weatherVariable = val2.weatherVariable;
					val3.weatherVariable2 = val2.weatherVariable2;
					list.Add(val3);
					Plugin.Log.LogWarning((object)("Added weather " + ((object)(LevelWeatherType)(ref val2.weatherType)).ToString() + " to clone planet data"));
				}
				val.randomWeathers = list.ToArray();
				Plugin.Log.LogWarning((object)"Finished cloning weather for clone planet data!");
				val.overrideWeather = item.overrideWeather;
				val.overrideWeatherType = item.overrideWeatherType;
				val.currentWeather = StartOfRound.Instance.levels[num].currentWeather;
				val.factorySizeMultiplier = item.factorySizeMultiplier;
				List<SpawnableMapObject> list2 = new List<SpawnableMapObject>();
				SpawnableMapObject[] spawnableMapObjects = item.spawnableMapObjects;
				foreach (SpawnableMapObject val4 in spawnableMapObjects)
				{
					SpawnableMapObject val5 = new SpawnableMapObject();
					val5.prefabToSpawn = val4.prefabToSpawn;
					val5.spawnFacingAwayFromWall = val4.spawnFacingAwayFromWall;
					val5.numberToSpawn = val4.numberToSpawn;
					list2.Add(val5);
					Plugin.Log.LogWarning((object)("Added map object " + ((Object)val4.prefabToSpawn).name + " to clone planet data"));
				}
				val.spawnableMapObjects = list2.ToArray();
				Plugin.Log.LogWarning((object)"Finished cloning map objects for clone planet data!");
				List<SpawnableOutsideObjectWithRarity> list3 = new List<SpawnableOutsideObjectWithRarity>();
				SpawnableOutsideObjectWithRarity[] spawnableOutsideObjects = item.spawnableOutsideObjects;
				foreach (SpawnableOutsideObjectWithRarity val6 in spawnableOutsideObjects)
				{
					SpawnableOutsideObjectWithRarity val7 = new SpawnableOutsideObjectWithRarity();
					val7.spawnableObject = val6.spawnableObject;
					val7.randomAmount = val6.randomAmount;
					list3.Add(val7);
					Plugin.Log.LogWarning((object)("Added outside map object " + ((Object)val6.spawnableObject.prefabToSpawn).name + " to clone planet data"));
				}
				val.spawnableOutsideObjects = list3.ToArray();
				Plugin.Log.LogWarning((object)"Finished cloning outside map objects for clone planet data!");
				List<SpawnableItemWithRarity> list4 = new List<SpawnableItemWithRarity>();
				foreach (SpawnableItemWithRarity item2 in item.spawnableScrap)
				{
					SpawnableItemWithRarity val8 = new SpawnableItemWithRarity();
					val8.spawnableItem = item2.spawnableItem;
					val8.rarity = item2.rarity;
					list4.Add(val8);
					Plugin.Log.LogWarning((object)("Added scrap object " + item2.spawnableItem.itemName + " to clone planet data"));
				}
				val.spawnableScrap = list4;
				Plugin.Log.LogWarning((object)"Finished cloning scrap objects for clone planet data!");
				val.minScrap = item.minScrap;
				val.maxScrap = item.maxScrap;
				val.minTotalScrapValue = item.minTotalScrapValue;
				val.maxTotalScrapValue = item.maxTotalScrapValue;
				val.levelAmbienceClips = item.levelAmbienceClips;
				val.maxEnemyPowerCount = item.maxEnemyPowerCount;
				val.maxOutsideEnemyPowerCount = item.maxOutsideEnemyPowerCount;
				val.maxDaytimeEnemyPowerCount = item.maxDaytimeEnemyPowerCount;
				List<SpawnableEnemyWithRarity> list5 = new List<SpawnableEnemyWithRarity>();
				foreach (SpawnableEnemyWithRarity enemy in item.Enemies)
				{
					EnemyType val9 = ScriptableObject.CreateInstance<EnemyType>();
					val9.enemyName = ((Object)enemy.enemyType).name;
					val9.probabilityCurve = enemy.enemyType.probabilityCurve;
					val9.numberSpawnedFalloff = enemy.enemyType.numberSpawnedFalloff;
					val9.enemyPrefab = enemy.enemyType.enemyPrefab;
					val9.PowerLevel = enemy.enemyType.PowerLevel;
					val9.MaxCount = enemy.enemyType.MaxCount;
					val9.numberSpawned = enemy.enemyType.numberSpawned;
					val9.isOutsideEnemy = enemy.enemyType.isOutsideEnemy;
					val9.isDaytimeEnemy = enemy.enemyType.isDaytimeEnemy;
					val9.normalizedTimeInDayToLeave = enemy.enemyType.normalizedTimeInDayToLeave;
					val9.stunTimeMultiplier = enemy.enemyType.stunTimeMultiplier;
					val9.doorSpeedMultiplier = enemy.enemyType.doorSpeedMultiplier;
					val9.stunGameDifficultyMultiplier = enemy.enemyType.stunGameDifficultyMultiplier;
					val9.canBeStunned = enemy.enemyType.canBeStunned;
					val9.canDie = enemy.enemyType.canDie;
					val9.destroyOnDeath = enemy.enemyType.destroyOnDeath;
					val9.canSeeThroughFog = enemy.enemyType.canSeeThroughFog;
					val9.timeToPlayAudio = enemy.enemyType.timeToPlayAudio;
					val9.loudnessMultiplier = enemy.enemyType.loudnessMultiplier;
					val9.overrideVentSFX = enemy.enemyType.overrideVentSFX;
					val9.hitBodySFX = enemy.enemyType.hitBodySFX;
					val9.hitEnemyVoiceSFX = enemy.enemyType.hitEnemyVoiceSFX;
					val9.deathSFX = enemy.enemyType.deathSFX;
					val9.stunSFX = enemy.enemyType.stunSFX;
					val9.audioClips = enemy.enemyType.audioClips;
					SpawnableEnemyWithRarity val10 = new SpawnableEnemyWithRarity();
					val10.enemyType = val9;
					val10.rarity = enemy.rarity;
					list5.Add(val10);
					Plugin.Log.LogWarning((object)("Added enemy " + val10.enemyType.enemyName + " to clone planet data"));
				}
				val.Enemies = list5;
				Plugin.Log.LogWarning((object)"Finished cloning enemies for clone planet data!");
				List<SpawnableEnemyWithRarity> list6 = new List<SpawnableEnemyWithRarity>();
				foreach (SpawnableEnemyWithRarity outsideEnemy in item.OutsideEnemies)
				{
					EnemyType val11 = ScriptableObject.CreateInstance<EnemyType>();
					val11.enemyName = ((Object)outsideEnemy.enemyType).name;
					val11.probabilityCurve = outsideEnemy.enemyType.probabilityCurve;
					val11.numberSpawnedFalloff = outsideEnemy.enemyType.numberSpawnedFalloff;
					val11.enemyPrefab = outsideEnemy.enemyType.enemyPrefab;
					val11.PowerLevel = outsideEnemy.enemyType.PowerLevel;
					val11.MaxCount = outsideEnemy.enemyType.MaxCount;
					val11.numberSpawned = outsideEnemy.enemyType.numberSpawned;
					val11.isOutsideEnemy = outsideEnemy.enemyType.isOutsideEnemy;
					val11.isDaytimeEnemy = outsideEnemy.enemyType.isDaytimeEnemy;
					val11.normalizedTimeInDayToLeave = outsideEnemy.enemyType.normalizedTimeInDayToLeave;
					val11.stunTimeMultiplier = outsideEnemy.enemyType.stunTimeMultiplier;
					val11.doorSpeedMultiplier = outsideEnemy.enemyType.doorSpeedMultiplier;
					val11.stunGameDifficultyMultiplier = outsideEnemy.enemyType.stunGameDifficultyMultiplier;
					val11.canBeStunned = outsideEnemy.enemyType.canBeStunned;
					val11.canDie = outsideEnemy.enemyType.canDie;
					val11.destroyOnDeath = outsideEnemy.enemyType.destroyOnDeath;
					val11.canSeeThroughFog = outsideEnemy.enemyType.canSeeThroughFog;
					val11.timeToPlayAudio = outsideEnemy.enemyType.timeToPlayAudio;
					val11.loudnessMultiplier = outsideEnemy.enemyType.loudnessMultiplier;
					val11.overrideVentSFX = outsideEnemy.enemyType.overrideVentSFX;
					val11.hitBodySFX = outsideEnemy.enemyType.hitBodySFX;
					val11.hitEnemyVoiceSFX = outsideEnemy.enemyType.hitEnemyVoiceSFX;
					val11.deathSFX = outsideEnemy.enemyType.deathSFX;
					val11.stunSFX = outsideEnemy.enemyType.stunSFX;
					val11.audioClips = outsideEnemy.enemyType.audioClips;
					SpawnableEnemyWithRarity val12 = new SpawnableEnemyWithRarity();
					val12.enemyType = val11;
					val12.rarity = outsideEnemy.rarity;
					list6.Add(val12);
					Plugin.Log.LogWarning((object)("Added outside enemy " + val12.enemyType.enemyName + " to clone planet data"));
				}
				val.OutsideEnemies = list6;
				Plugin.Log.LogWarning((object)"Finished cloning outside enemies for clone planet data!");
				List<SpawnableEnemyWithRarity> list7 = new List<SpawnableEnemyWithRarity>();
				foreach (SpawnableEnemyWithRarity daytimeEnemy in item.DaytimeEnemies)
				{
					EnemyType val13 = ScriptableObject.CreateInstance<EnemyType>();
					val13.enemyName = ((Object)daytimeEnemy.enemyType).name;
					val13.probabilityCurve = daytimeEnemy.enemyType.probabilityCurve;
					val13.numberSpawnedFalloff = daytimeEnemy.enemyType.numberSpawnedFalloff;
					val13.enemyPrefab = daytimeEnemy.enemyType.enemyPrefab;
					val13.PowerLevel = daytimeEnemy.enemyType.PowerLevel;
					val13.MaxCount = daytimeEnemy.enemyType.MaxCount;
					val13.numberSpawned = daytimeEnemy.enemyType.numberSpawned;
					val13.isOutsideEnemy = daytimeEnemy.enemyType.isOutsideEnemy;
					val13.isDaytimeEnemy = daytimeEnemy.enemyType.isDaytimeEnemy;
					val13.normalizedTimeInDayToLeave = daytimeEnemy.enemyType.normalizedTimeInDayToLeave;
					val13.stunTimeMultiplier = daytimeEnemy.enemyType.stunTimeMultiplier;
					val13.doorSpeedMultiplier = daytimeEnemy.enemyType.doorSpeedMultiplier;
					val13.stunGameDifficultyMultiplier = daytimeEnemy.enemyType.stunGameDifficultyMultiplier;
					val13.canBeStunned = daytimeEnemy.enemyType.canBeStunned;
					val13.canDie = daytimeEnemy.enemyType.canDie;
					val13.destroyOnDeath = daytimeEnemy.enemyType.destroyOnDeath;
					val13.canSeeThroughFog = daytimeEnemy.enemyType.canSeeThroughFog;
					val13.timeToPlayAudio = daytimeEnemy.enemyType.timeToPlayAudio;
					val13.loudnessMultiplier = daytimeEnemy.enemyType.loudnessMultiplier;
					val13.overrideVentSFX = daytimeEnemy.enemyType.overrideVentSFX;
					val13.hitBodySFX = daytimeEnemy.enemyType.hitBodySFX;
					val13.hitEnemyVoiceSFX = daytimeEnemy.enemyType.hitEnemyVoiceSFX;
					val13.deathSFX = daytimeEnemy.enemyType.deathSFX;
					val13.stunSFX = daytimeEnemy.enemyType.stunSFX;
					val13.audioClips = daytimeEnemy.enemyType.audioClips;
					SpawnableEnemyWithRarity val14 = new SpawnableEnemyWithRarity();
					val14.enemyType = val13;
					val14.rarity = daytimeEnemy.rarity;
					list7.Add(val14);
					Plugin.Log.LogWarning((object)("Added daytime enemy " + val14.enemyType.enemyName + " to clone planet data"));
				}
				val.DaytimeEnemies = list7;
				Plugin.Log.LogWarning((object)"Finished cloning daytime enemies for clone planet data!");
				val.enemySpawnChanceThroughoutDay = item.enemySpawnChanceThroughoutDay;
				val.outsideEnemySpawnChanceThroughDay = item.outsideEnemySpawnChanceThroughDay;
				val.daytimeEnemySpawnChanceThroughDay = item.daytimeEnemySpawnChanceThroughDay;
				val.spawnProbabilityRange = item.spawnProbabilityRange;
				val.daytimeEnemiesProbabilityRange = item.daytimeEnemiesProbabilityRange;
				val.levelIncludesSnowFootprints = item.levelIncludesSnowFootprints;
				levelsCopy.Add(val);
				Plugin.Log.LogMessage((object)("Created a shallow copy of level " + val.PlanetName));
				num++;
			}
			return levelsCopy;
		}
	}
	public class PlanetHeatManager : ManagerBase
	{
		public static PlanetHeatManager Instance;

		public float currentLevelHeat;

		public Dictionary<string, float> heatVals = new Dictionary<string, float>();

		public void Start()
		{
			Instance = this;
		}

		public void SetupHeat()
		{
			Plugin.Log.LogMessage((object)"Setting up heat manager");
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel val in levels)
			{
				heatVals.Add(val.PlanetName, 0f);
			}
		}

		public void HeatLogicTick()
		{
			Plugin.Log.LogMessage((object)"Doing heat logic!");
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel val in levels)
			{
				if (val.PlanetName == PlanetManager.currentLevel.PlanetName)
				{
					heatVals[val.PlanetName] = Mathf.Clamp(heatVals[val.PlanetName] + 15f, 0f, 100f);
					currentLevelHeat = heatVals[val.PlanetName];
					Plugin.Log.LogMessage((object)("Increased heat for level " + val.PlanetName));
				}
				else
				{
					heatVals[val.PlanetName] = Mathf.Clamp(heatVals[val.PlanetName] - 5f, 0f, 100f);
					Plugin.Log.LogMessage((object)("Decreased heat for level " + val.PlanetName));
				}
			}
		}

		public int ReturnSyncedHeatConfidence()
		{
			return new Random(0).Next(-10, 10);
		}
	}
	public class PlanetManager : ManagerBase
	{
		public static PlanetManager Instance;

		public static SelectableLevel currentLevel;

		public bool Landed;

		private static readonly Action BaseAct;

		public List<GameObject> allLevelEvents = new List<GameObject>();

		public List<GameObject> seasonalEvents = new List<GameObject>();

		public List<GameObject> activeLevelEvents = new List<GameObject>();

		private bool clientUpdated;

		private bool waitToEvent;

		private int waitEventID;

		private bool seasonalTester;

		public static event Action BaseEventsRegistered;

		public void Start()
		{
			seasonalTester = false;
			Instance = this;
			Plugin.Log.LogInfo((object)"Setting up LC_API Networking for PlanetManager");
			Networking.GetString = (Action<string, string>)Delegate.Combine(Networking.GetString, new Action<string, string>(Instance.ClientBCR_EventSYNC));
			Plugin.Log.LogInfo((object)"Added to GetString with ClientBCR_EventSYNC");
			GameState.WentIntoOrbit += DoEventCleanupLogic;
			GameState.ShipStartedLeaving += DoEventCleanupInit;
			GameState.LandOnMoon += Land;
			CreateAndAddEvent<LevelEventNone>("NoneEvent", Plugin.cNoneProb.Value);
			CreateAndAddEvent<LevelEventFreeMoney>("MoneyEvent", Plugin.cMoneyProb.Value);
			CreateAndAddEvent<LevelEventFakeFreeMoney>("FakeMoneyEvent", Plugin.cFakeMoneyProb.Value);
			CreateAndAddEvent<LevelEventTurretHell>("TurretHellEvent", Plugin.cTurretProb.Value);
			CreateAndAddEvent<LevelEventLandmineHell>("LandmineHellEvent", Plugin.cLandmineProb.Value);
			CreateAndAddEvent<LevelEventHoardingTown>("HoardingTownEvent", Plugin.cHoardingProb.Value);
			CreateAndAddEvent<LevelEventAllSnareFlea>("SnareFleaEvent", Plugin.cSnareProb.Value);
			CreateAndAddEvent<LevelEventBrackenAndCoils>("WorstComboEvent", Plugin.cWorstComboProb.Value);
			CreateAndAddEvent<LevelEventChaosCompany>("ChaosEvent", Plugin.cChaosProb.Value);
			CreateAndAddEvent<LevelEventDelivery>("DeliveryEvent", Plugin.cDeliveryProb.Value);
			CreateAndAddEvent<LevelEventUnfairCompany>("UnfairEvent", Plugin.cUnfairProb.Value);
			CreateAndAddEvent<LevelEventWrongOrder>("WrongOrderEvent", Plugin.cWrongOrderProb.Value);
			CreateAndAddEvent<LevelEventGhostGirl>("GhostGirlEvent", Plugin.cGhostProb.Value);
			CreateAndAddEvent<LevelEventVanillaGame>("VanillaEvent", Plugin.cVanillaProb.Value);
			if (((DateTime.Now.Month == 12) & (DateTime.Now.Day == 25)) | seasonalTester)
			{
				CreateAndAddEvent<LevelEventSeasonalChristmas>("ChirstmasEvent", Plugin.cSeasonalEventProb.Value, seasonal: true);
				Plugin.Log.LogMessage((object)"Merry Christmas!!");
			}
			DelegateExtensions.InvokeActionSafe(PlanetManager.BaseEventsRegistered);
		}

		public void Update()
		{
			if (activeLevelEvents.Count > 0)
			{
				foreach (GameObject activeLevelEvent in activeLevelEvents)
				{
					if ((Object)(object)activeLevelEvent != (Object)null)
					{
						activeLevelEvent.GetComponent<LevelEventBase>().EventUpdate();
					}
				}
			}
			if (clientUpdated & waitToEvent)
			{
				Plugin.Log.LogWarning((object)"Client updated and we got event data from the host, doing client event logic!");
				clientUpdated = false;
				waitToEvent = false;
				PlanetHeatManager.Instance.HeatLogicTick();
				EnableSpecificEvent(allLevelEvents[waitEventID]);
			}
		}

		public void DoEventLogic()
		{
			Plugin.Log.LogWarning((object)"Got call to start event logic and update heat!");
			PlanetHeatManager.Instance.HeatLogicTick();
			if (((NetworkBehaviour)StartOfRound.Instance).IsHost)
			{
				int index = Random.Range(0, allLevelEvents.Count);
				EnableSpecificEvent(allLevelEvents[index]);
				Networking.Broadcast(index.ToString(), "BCR_EventSYNC");
			}
		}

		public void ClientEventSetup(int level)
		{
			if (!((NetworkBehaviour)StartOfRound.Instance).IsHost)
			{
				Plugin.Log.LogWarning((object)"Client updating!");
				currentLevel = StartOfRound.Instance.levels[level];
				clientUpdated = true;
				Plugin.Log.LogWarning((object)"Client updated!");
			}
		}

		public void DoEventLogic(int eventID)
		{
			if ((Object)(object)allLevelEvents[eventID] != (Object)null)
			{
				waitEventID = eventID;
				waitToEvent = true;
				Plugin.Log.LogWarning((object)"Parsed event data from the host, waiting for us to be updated before doing event logic!");
			}
			else
			{
				GameTips.ShowTip("Error!", "Failed to parse event data from host. You probably dont have a custom event installed.");
			}
		}

		public void DoEventCleanupLogic()
		{
			waitToEvent = false;
			clientUpdated = false;
			RevertAllPlanetsToNormal();
		}

		public void DoEventCleanupInit()
		{
			DisableAllEvents();
			Landed = false;
		}

		public void Land()
		{
			Landed = true;
		}

		public void ClientBCR_EventSYNC(string data, string signature)
		{
			if (signature == "BCR_EventSYNC")
			{
				DoEventLogic(int.Parse(data));
			}
		}

		public void EnableSpecificEvent(GameObject eventTarget)
		{
			foreach (GameObject allLevelEvent in allLevelEvents)
			{
				if ((Object)(object)allLevelEvent == (Object)(object)eventTarget && !allLevelEvent.GetComponent<LevelEventBase>().ForceDisable)
				{
					allLevelEvent.GetComponent<LevelEventBase>().EnableEvent();
					allLevelEvent.GetComponent<LevelEventBase>().EventIsEnabled = true;
					activeLevelEvents.Add(allLevelEvent);
				}
			}
		}

		public void DisableSpecificEvent(GameObject eventTarget)
		{
			foreach (GameObject allLevelEvent in allLevelEvents)
			{
				if ((Object)(object)allLevelEvent == (Object)(object)eventTarget && allLevelEvent.GetComponent<LevelEventBase>().EventIsEnabled)
				{
					allLevelEvent.GetComponent<LevelEventBase>().DisableEvent();
					allLevelEvent.GetComponent<LevelEventBase>().EventIsEnabled = false;
					if (activeLevelEvents.Contains(allLevelEvent))
					{
						activeLevelEvents.Remove(allLevelEvent);
					}
				}
			}
		}

		public void EnableAllEvents()
		{
			foreach (GameObject allLevelEvent in allLevelEvents)
			{
				if (!allLevelEvent.GetComponent<LevelEventBase>().ForceDisable)
				{
					allLevelEvent.GetComponent<LevelEventBase>().EnableEvent();
					allLevelEvent.GetComponent<LevelEventBase>().EventIsEnabled = true;
					activeLevelEvents.Add(allLevelEvent);
				}
			}
		}

		public void DisableAllEvents()
		{
			foreach (GameObject allLevelEvent in allLevelEvents)
			{
				if (allLevelEvent.GetComponent<LevelEventBase>().EventIsEnabled)
				{
					allLevelEvent.GetComponent<LevelEventBase>().DisableEvent();
					allLevelEvent.GetComponent<LevelEventBase>().EventIsEnabled = false;
					if (activeLevelEvents.Contains(allLevelEvent))
					{
						activeLevelEvents.Remove(allLevelEvent);
					}
				}
			}
		}

		public void RevertAllPlanetsToNormal()
		{
			StartOfRound.Instance.levels = (SelectableLevel[])PlanetDataHolder.PopulateAndReturnCloneList().ToArray().Clone();
			PlanetDataHolder.levelsCopy.Clear();
			StartOfRound.Instance.ChangeLevel(currentLevel.levelID);
			((MonoBehaviour)this).StartCoroutine(TerminalUpdate());
		}

		public void CreateAndAddEvent<I>(string name, int probability = 1, bool seasonal = false) where I : LevelEventBase
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			int num = Mathf.Clamp(probability, 0, 10);
			Plugin.Log.LogMessage((object)("Registering event with name (" + name + "), probability (" + num + ")"));
			for (int i = 0; i < num; i++)
			{
				GameObject val = new GameObject(name);
				val.AddComponent<I>();
				allLevelEvents.Add(val);
				if (seasonal)
				{
					seasonalEvents.Add(val);
				}
				Object.DontDestroyOnLoad((Object)(object)val);
			}
		}

		public static IEnumerator TerminalUpdate()
		{
			yield return (object)new WaitForSeconds(1f);
			Object.FindObjectOfType<Terminal>().moonsCatalogueList = StartOfRound.Instance.levels;
		}

		static PlanetManager()
		{
			PlanetManager.BaseEventsRegistered = BaseAct;
		}
	}
	internal class QuotaManager : ManagerBase
	{
		public TimeOfDay TOD;

		public void Update()
		{
			if ((Object)(object)TOD == (Object)null)
			{
				TOD = Object.FindFirstObjectByType<TimeOfDay>();
			}
			else
			{
				TOD.quotaVariables.baseIncrease = 275f;
			}
		}
	}
}
namespace BrutalCompanyReborn.Data
{
	internal static class DeepCopyEx
	{
		public static T DeepCopy<T>(this T original) where T : class
		{
			using MemoryStream memoryStream = new MemoryStream();
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			binaryFormatter.Serialize(memoryStream, original);
			memoryStream.Seek(0L, SeekOrigin.Begin);
			return (T)binaryFormatter.Deserialize(memoryStream);
		}

		public static List<T> Clone<T>(this List<T> originalList) where T : ICloneable
		{
			return originalList.ConvertAll((T x) => (T)x.Clone());
		}
	}
}
namespace BrutalCompanyReborn.Comp.LevelEvents
{
	internal class LevelEventAllSnareFlea : LevelEventBase
	{
		public override void EnableEvent()
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			EventNameColor = "<color=red>";
			EventName = "Oops, all snare fleas!";
			EventDescription = "Be sure to look up.";
			ShowEventPopup();
			DoBaseEventMods();
			foreach (SpawnableEnemyWithRarity enemy in PlanetManager.currentLevel.Enemies)
			{
				enemy.rarity = 0;
				if (Object.op_Implicit((Object)(object)enemy.enemyType.enemyPrefab.GetComponent<CentipedeAI>()))
				{
					enemy.rarity = 999;
					enemy.enemyType.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
					{
						new Keyframe(0f, 200f),
						new Keyframe(100f, 200f)
					});
				}
			}
		}

		public override void DisableEvent()
		{
		}
	}
	public class LevelEventBase : MonoBehaviour
	{
		public string EventName;

		public string EventNameColor;

		public string EventDescription;

		public bool EventShouldWarn;

		public bool EventIsEnabled;

		public bool ForceDisable;

		public bool MarkedForRemoval;

		private float heatDeviation;

		public virtual void EnableEvent()
		{
		}

		public virtual void EventUpdate()
		{
		}

		public virtual void DisableEvent()
		{
		}

		public void DoBaseEventMods()
		{
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Expected O, but got Unknown
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Expected O, but got Unknown
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Expected O, but got Unknown
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Expected O, but got Unknown
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Expected O, but got Unknown
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Expected O, but got Unknown
			Plugin.Log.LogWarning((object)"Doing base event mods");
			SelectableLevel currentLevel = PlanetManager.currentLevel;
			SelectableLevel val = PlanetManager.currentLevel;
			foreach (SelectableLevel item in PlanetDataHolder.levelsOriginal)
			{
				if (item.PlanetName == PlanetManager.currentLevel.PlanetName)
				{
					val = item;
				}
			}
			Plugin.Log.LogMessage((object)"Accessed current level");
			Plugin.Log.LogMessage((object)PlanetDataHolder.levelsOriginal[0].maxScrap);
			Plugin.Log.LogMessage((object)"Checking PlanetDataHolder data success");
			currentLevel.minScrap = 9;
			currentLevel.maxScrap = val.maxScrap + 45;
			currentLevel.minTotalScrapValue = 0;
			currentLevel.maxTotalScrapValue = val.maxTotalScrapValue + 800;
			currentLevel.daytimeEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(0f, 7f),
				new Keyframe(0.5f, 7f)
			});
			currentLevel.maxEnemyPowerCount = val.maxEnemyPowerCount + 2000;
			currentLevel.maxOutsideEnemyPowerCount = val.maxOutsideEnemyPowerCount + 20;
			currentLevel.maxDaytimeEnemyPowerCount = val.maxDaytimeEnemyPowerCount + 200;
			foreach (SpawnableEnemyWithRarity outsideEnemy in currentLevel.OutsideEnemies)
			{
				if (Object.op_Implicit((Object)(object)outsideEnemy.enemyType.enemyPrefab.GetComponent<BaboonBirdAI>()))
				{
					outsideEnemy.enemyType.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
					{
						new Keyframe(0f, 1f),
						new Keyframe(1f, 0f)
					});
					outsideEnemy.enemyType.MaxCount = 12;
				}
				if (Object.op_Implicit((Object)(object)outsideEnemy.enemyType.enemyPrefab.GetComponent<MouthDogAI>()))
				{
					outsideEnemy.enemyType.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
					{
						new Keyframe(0f, 0f),
						new Keyframe(1f, 1f)
					});
					outsideEnemy.enemyType.MaxCount = 4;
				}
				if (Object.op_Implicit((Object)(object)outsideEnemy.enemyType.enemyPrefab.GetComponent<ForestGiantAI>()))
				{
					outsideEnemy.enemyType.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
					{
						new Keyframe(0f, -100f),
						new Keyframe(0.8f, -100f),
						new Keyframe(1f, 1f)
					});
					outsideEnemy.enemyType.MaxCount = 1;
				}
				if (Object.op_Implicit((Object)(object)outsideEnemy.enemyType.enemyPrefab.GetComponent<SandWormAI>()))
				{
					outsideEnemy.enemyType.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
					{
						new Keyframe(0f, -100f),
						new Keyframe(1f, -100f)
					});
					outsideEnemy.enemyType.MaxCount = 1;
				}
			}
			currentLevel.enemySpawnChanceThroughoutDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(0f, 0.1f + PlanetHeatManager.Instance.currentLevelHeat),
				new Keyframe(0.5f, 500f + PlanetHeatManager.Instance.currentLevelHeat)
			});
			currentLevel.outsideEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(0f, -19f + PlanetHeatManager.Instance.currentLevelHeat),
				new Keyframe(1f, 0f + PlanetHeatManager.Instance.currentLevelHeat)
			});
		}

		public void ShowEventPopup()
		{
			GameTips.ShowTip(EventNameColor + EventName + "</color>", EventDescription);
			heatDeviation = PlanetHeatManager.Instance.ReturnSyncedHeatConfidence();
			float num = PlanetHeatManager.Instance.currentLevelHeat + heatDeviation;
			num = Mathf.Clamp(num, 0f, 100f);
			GameTips.ShowTip("HEAT FORCAST", "Moon heat estimated to be " + num + "%\n(" + (100f - Mathf.Abs(num)) + "% Confidence)");
		}
	}
	internal class LevelEventBrackenAndCoils : LevelEventBase
	{
		public override void EnableEvent()
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			EventNameColor = "<color=red>";
			EventName = "The worst combo";
			EventDescription = "Have fun!";
			ShowEventPopup();
			DoBaseEventMods();
			foreach (SpawnableEnemyWithRarity enemy in PlanetManager.currentLevel.Enemies)
			{
				enemy.rarity = 0;
				if (Object.op_Implicit((Object)(object)enemy.enemyType.enemyPrefab.GetComponent<FlowermanAI>()))
				{
					enemy.rarity = 999;
					enemy.enemyType.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
					{
						new Keyframe(0f, 200f),
						new Keyframe(100f, 200f)
					});
				}
				if (Object.op_Implicit((Object)(object)enemy.enemyType.enemyPrefab.GetComponent<SpringManAI>()))
				{
					enemy.rarity = 999;
					enemy.enemyType.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
					{
						new Keyframe(0f, 200f),
						new Keyframe(100f, 200f)
					});
				}
			}
		}

		public override void DisableEvent()
		{
		}
	}
	internal class LevelEventChaosCompany : LevelEventBase
	{
		public override void EnableEvent()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			EventNameColor = "<color=red>";
			EventName = "Chaos Company";
			EventDescription = "You might want to have someone stay behind for this one.";
			ShowEventPopup();
			DoBaseEventMods();
			foreach (SpawnableEnemyWithRarity enemy in PlanetManager.currentLevel.Enemies)
			{
				enemy.rarity = 999;
				enemy.enemyType.MaxCount = 90;
				enemy.enemyType.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
				{
					new Keyframe(0f, 200f),
					new Keyframe(100f, 200f)
				});
			}
			PlanetManager.currentLevel.enemySpawnChanceThroughoutDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(0f, 100f),
				new Keyframe(1f, 100f)
			});
		}

		public override void DisableEvent()
		{
		}
	}
	internal class LevelEventDelivery : LevelEventBase
	{
		public override void EnableEvent()
		{
			EventNameColor = "<color=green>";
			EventName = "Delivery!";
			EventDescription = "The Company has decided to give you a gift.";
			ShowEventPopup();
			DoBaseEventMods();
			if (((NetworkBehaviour)StartOfRound.Instance).IsHost)
			{
				int num = Random.Range(2, 9);
				for (int i = 0; i < num; i++)
				{
					int item = Random.Range(0, 6);
					Object.FindObjectOfType<Terminal>().orderedItemsFromTerminal.Add(item);
				}
			}
		}

		public override void DisableEvent()
		{
		}
	}
	internal class LevelEventFakeFreeMoney : LevelEventBase
	{
		public override void EnableEvent()
		{
			EventNameColor = "<color=green>";
			EventName = "Free money?";
			EventDescription = "Check the computer terminal, and spend some money.";
			ShowEventPopup();
			DoBaseEventMods();
			if (((NetworkBehaviour)StartOfRound.Instance).IsHost)
			{
				Terminal val = Object.FindObjectOfType<Terminal>();
				val.groupCredits += 1000;
				val.SyncGroupCreditsServerRpc(val.groupCredits, val.numberOfItemsInDropship);
			}
		}

		public override void DisableEvent()
		{
			if (((NetworkBehaviour)StartOfRound.Instance).IsHost)
			{
				Terminal val = Object.FindObjectOfType<Terminal>();
				val.groupCredits -= 1000;
				val.SyncGroupCreditsServerRpc(val.groupCredits, val.numberOfItemsInDropship);
			}
			HUDManager.Instance.DisplayTip("About that money...", "We did not mean to give you 1000 credits in the terminal. we have subtracted 1000 credits from your balance.", true, false, "LC_Tip1");
		}
	}
	internal class LevelEventFreeMoney : LevelEventBase
	{
		public override void EnableEvent()
		{
			EventNameColor = "<color=green>";
			EventName = "Free money!";
			EventDescription = "Check the computer terminal, and spend some money.";
			ShowEventPopup();
			DoBaseEventMods();
			if (((NetworkBehaviour)StartOfRound.Instance).IsHost)
			{
				Terminal val = Object.FindObjectOfType<Terminal>();
				val.groupCredits += 400;
				val.SyncGroupCreditsServerRpc(val.groupCredits, val.numberOfItemsInDropship);
			}
		}

		public override void DisableEvent()
		{
		}
	}
	internal class LevelEventGhostGirl : LevelEventBase
	{
		public override void EnableEvent()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			EventNameColor = "<color=red>";
			EventName = "Schizophrenia";
			EventDescription = "Theres nobody behind you, dont worry.";
			ShowEventPopup();
			DoBaseEventMods();
			foreach (SpawnableEnemyWithRarity enemy in PlanetManager.currentLevel.Enemies)
			{
				if (Object.op_Implicit((Object)(object)enemy.enemyType.enemyPrefab.GetComponent<DressGirlAI>()))
				{
					enemy.rarity = 999;
					enemy.enemyType.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
					{
						new Keyframe(0f, 200f),
						new Keyframe(100f, 200f)
					});
				}
			}
		}

		public override void DisableEvent()
		{
		}
	}
	internal class LevelEventHoardingTown : LevelEventBase
	{
		public int prevRare;

		public AnimationCurve prevCurve;

		public override void EnableEvent()
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Expected O, but got Unknown
			EventNameColor = "<color=red>";
			EventName = "Hoarding town";
			EventDescription = "Get to the scrap, before they do.";
			ShowEventPopup();
			DoBaseEventMods();
			foreach (SpawnableEnemyWithRarity enemy in PlanetManager.currentLevel.Enemies)
			{
				if (Object.op_Implicit((Object)(object)enemy.enemyType.enemyPrefab.GetComponent<HoarderBugAI>()))
				{
					prevRare = enemy.rarity;
					prevCurve = enemy.enemyType.probabilityCurve;
					enemy.rarity = 999;
					enemy.enemyType.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
					{
						new Keyframe(0f, 200f),
						new Keyframe(100f, 200f)
					});
				}
			}
		}

		public override void DisableEvent()
		{
			foreach (SpawnableEnemyWithRarity enemy in PlanetManager.currentLevel.Enemies)
			{
				Object.op_Implicit((Object)(object)enemy.enemyType.enemyPrefab.GetComponent<HoarderBugAI>());
			}
		}
	}
	internal class LevelEventLandmineHell : LevelEventBase
	{
		public AnimationCurve prevSpawnCurve;

		public override void EnableEvent()
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			EventNameColor = "<color=red>";
			EventName = "Landmine hell";
			EventDescription = "Watch your step...";
			ShowEventPopup();
			DoBaseEventMods();
			SpawnableMapObject[] spawnableMapObjects = PlanetManager.currentLevel.spawnableMapObjects;
			foreach (SpawnableMapObject val in spawnableMapObjects)
			{
				if ((Object)(object)val.prefabToSpawn.GetComponentInChildren<Landmine>() != (Object)null)
				{
					prevSpawnCurve = val.numberToSpawn;
					val.numberToSpawn = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
					{
						new Keyframe(0f, 300f),
						new Keyframe(1f, 170f)
					});
				}
			}
		}

		public override void DisableEvent()
		{
			SpawnableMapObject[] spawnableMapObjects = PlanetManager.currentLevel.spawnableMapObjects;
			foreach (SpawnableMapObject val in spawnableMapObjects)
			{
				if ((Object)(object)val.prefabToSpawn.GetComponentInChildren<Landmine>() != (Object)null)
				{
					val.numberToSpawn = prevSpawnCurve;
				}
			}
		}
	}
	internal class LevelEventNone : LevelEventBase
	{
		public override void EnableEvent()
		{
			EventNameColor = "<color=green>";
			EventName = "None";
			EventDescription = "No event present on this moon.";
			ShowEventPopup();
			DoBaseEventMods();
		}

		public override void DisableEvent()
		{
		}
	}
	internal class LevelEventSeasonalChristmas : LevelEventBase
	{
		public override void EnableEvent()
		{
			EventNameColor = "<color=green>";
			EventName = "Merry Chirstmas!";
			EventDescription = "The Company has decided to give you gifts!";
			ShowEventPopup();
			DoBaseEventMods();
			if (((NetworkBehaviour)StartOfRound.Instance).IsHost)
			{
				int num = Random.Range(9, 9);
				for (int i = 0; i < num; i++)
				{
					int item = Random.Range(0, 6);
					Object.FindObjectOfType<Terminal>().orderedItemsFromTerminal.Add(item);
				}
			}
		}

		public override void DisableEvent()
		{
		}
	}
	internal class LevelEventTurretHell : LevelEventBase
	{
		public AnimationCurve prevSpawnCurve;

		public override void EnableEvent()
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			EventNameColor = "<color=red>";
			EventName = "Turret hell";
			EventDescription = "Maximum security.";
			ShowEventPopup();
			DoBaseEventMods();
			SpawnableMapObject[] spawnableMapObjects = PlanetManager.currentLevel.spawnableMapObjects;
			foreach (SpawnableMapObject val in spawnableMapObjects)
			{
				if ((Object)(object)val.prefabToSpawn.GetComponentInChildren<Turret>() != (Object)null)
				{
					prevSpawnCurve = val.numberToSpawn;
					val.numberToSpawn = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
					{
						new Keyframe(0f, 200f),
						new Keyframe(1f, 25f)
					});
				}
			}
		}

		public override void DisableEvent()
		{
			SpawnableMapObject[] spawnableMapObjects = PlanetManager.currentLevel.spawnableMapObjects;
			foreach (SpawnableMapObject val in spawnableMapObjects)
			{
				if ((Object)(object)val.prefabToSpawn.GetComponentInChildren<Turret>() != (Object)null)
				{
					val.numberToSpawn = prevSpawnCurve;
				}
			}
		}
	}
	internal class LevelEventUnfairCompany : LevelEventBase
	{
		public override void EnableEvent()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_00c2: 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)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			EventNameColor = "<color=red>";
			EventName = "Unfair Company";
			EventDescription = "GLHF";
			ShowEventPopup();
			DoBaseEventMods();
			foreach (SpawnableEnemyWithRarity outsideEnemy in PlanetManager.currentLevel.OutsideEnemies)
			{
				outsideEnemy.rarity = 999;
				outsideEnemy.enemyType.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
				{
					new Keyframe(0f, 200f),
					new Keyframe(100f, 200f)
				});
			}
			PlanetManager.currentLevel.outsideEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(0f, 999f),
				new Keyframe(20f, 999f)
			});
		}

		public override void DisableEvent()
		{
		}
	}
	internal class LevelEventVanillaGame : LevelEventBase
	{
		public override void EnableEvent()
		{
			EventNameColor = "<color=green>";
			EventName = "Vanilla scaling";
			EventDescription = "Enjoy it while it lasts";
			ShowEventPopup();
		}

		public override void DisableEvent()
		{
		}
	}
	internal class LevelEventWrongOrder : LevelEventBase
	{
		public override void EnableEvent()
		{
			EventNameColor = "<color=red>";
			EventName = "Lost in transit";
			EventDescription = "The Company lost your purchased items. 80 credits have been given as compensation.";
			ShowEventPopup();
			DoBaseEventMods();
			if (((NetworkBehaviour)StartOfRound.Instance).IsHost)
			{
				Terminal val = Object.FindObjectOfType<Terminal>();
				val.orderedItemsFromTerminal.Clear();
				val.groupCredits += 80;
				val.SyncGroupCreditsServerRpc(val.groupCredits, val.numberOfItemsInDropship);
			}
		}

		public override void DisableEvent()
		{
		}
	}
}