using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
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 BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalEvents.Common;
using LethalEvents.Configuration;
using LethalEvents.Events;
using LethalEvents.Patches;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LethalEvents")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Lethal Events")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalEvents")]
[assembly: AssemblyTitle("LethalEvents")]
[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 LethalEvents
{
[BepInPlugin("LethalEvents", "LethalEvents", "1.0.0")]
public class LethalEvents : BaseUnityPlugin
{
internal static LethalEvents Instance { get; set; }
internal static PlayerControllerB PlayerRef { get; set; }
private void Awake()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
LethalEventsState.Config = LethalConfig.BindConfigSettings();
Harmony val = new Harmony("LethalEvents");
LELogger.Mls = Logger.CreateLogSource("LethalEvents");
val.PatchAll(typeof(LevelLethalEventPatch));
val.PatchAll(typeof(AllowPlayerDeathPatch));
val.PatchAll(typeof(InfiniteSprintPatch));
val.PatchAll(typeof(NightVisionPatch));
val.PatchAll(typeof(PlayerControllerBStartPatch));
val.PatchAll(typeof(RoundManagerStartPatch));
LELogger.Mls = ((BaseUnityPlugin)this).Logger;
LogSplash();
}
private void LogSplash()
{
LELogger.Mls.LogMessage((object)"\r\n _ _ _ _ _____ _ \r\n| | | | | | | | | ___| | | \r\n| | ___| |_| |__ __ _| | | |____ _____ _ __ | |_ ___ \r\n| | / _ \\ __| '_ \\ / _` | | | __\\ \\ / / _ \\ '_ \\| __/ __|\r\n| |___| __/ |_| | | | (_| | | | |___\\ V / __/ | | | |_\\__ \\\r\n\\_____/\\___|\\__|_| |_|\\__,_|_| \\____/ \\_/ \\___|_| |_|\\__|___/\r\n \r\n");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "LethalEvents";
public const string PLUGIN_NAME = "LethalEvents";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace LethalEvents.Patches
{
[HarmonyPatch(typeof(PlayerControllerB), "AllowPlayerDeath")]
internal class AllowPlayerDeathPatch : IPatchable
{
[HarmonyPrefix]
private static bool OverrideDeath()
{
LELogger.Mls.LogMessage((object)"Override Death");
if (!LethalEventsState.IsHost)
{
return true;
}
return !LethalEventsState.EnableGod;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
internal class InfiniteSprintPatch : IPatchable
{
[HarmonyPostfix]
private static void Infinitesprint(ref float ___sprintMeter)
{
if (LethalEventsState.EnableInfiniteSprint)
{
Math.Clamp(___sprintMeter += 0.02f, 0f, 1f);
}
}
}
internal interface IPatchable
{
}
[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
internal class LevelLethalEventPatch : IPatchable
{
[HarmonyPrefix]
private static bool ModifyLevel(ref SelectableLevel newLevel)
{
LELogger.Mls.LogMessage((object)"Loaded new level. Initiating event sequence..");
if (!((NetworkBehaviour)RoundManager.Instance).IsHost)
{
LELogger.Mls.LogWarning((object)"Client not host, no modification will be made.");
return false;
}
LethalEventHandler.NormalizeLevel(newLevel);
if (newLevel.sceneName == "CompanyBuilding")
{
LELogger.Mls.LogInfo((object)"Company building, no events happen here.");
return false;
}
LethalEventHandler.HandleMoonHeat(newLevel);
SelectableLevel obj = newLevel;
obj.maxEnemyPowerCount += LethalEventsState.Config.MaxEnemyPowerIncrement.Value;
LethalEvent randomLethalEvent = LethalEventHandler.GetRandomLethalEvent(newLevel);
ILethalEvent lethalEventExecutor = LethalEventHandler.GetLethalEventExecutor(randomLethalEvent);
LethalEventHandler.LogCurrentMoonHeat(newLevel);
LethalEventHandler.LogLethalEventName(randomLethalEvent);
lethalEventExecutor.Execute(newLevel);
return true;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "SetNightVisionEnabled")]
internal class NightVisionPatch : IPatchable
{
[HarmonyPostfix]
private static void SetNightVisionEnabled()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
if (LethalEventsState.EnableNightVision)
{
LethalEvents.PlayerRef.nightVision.color = Color.green;
LethalEvents.PlayerRef.nightVision.intensity = 1000f;
LethalEvents.PlayerRef.nightVision.range = 10000f;
((Behaviour)LethalEvents.PlayerRef.nightVision).enabled = true;
}
}
}
[HarmonyPatch(typeof(PlayerControllerB), "Start")]
internal class PlayerControllerBStartPatch : IPatchable
{
[HarmonyPostfix]
private static void Start(ref PlayerControllerB __instance)
{
LethalEvents.PlayerRef = __instance;
}
}
[HarmonyPatch(typeof(RoundManager), "Start")]
internal class RoundManagerStartPatch : IPatchable
{
[HarmonyPrefix]
private static void setIsHost()
{
LELogger.Mls.LogMessage((object)"Start");
LethalEventsState.IsHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost;
}
}
}
namespace LethalEvents.Events
{
internal class ArachnophobiaEvent : ILethalEvent
{
void ILethalEvent.Execute(SelectableLevel currentLevel)
{
LethalEventHandler.SetEnemiesRarity<SandSpiderAI>(currentLevel);
}
}
internal class BrackenAndCoilEvent : ILethalEvent
{
void ILethalEvent.Execute(SelectableLevel currentLevel)
{
LethalEventHandler.SetEnemiesRarity<FlowermanAI>(currentLevel);
LethalEventHandler.SetEnemiesRarity<SpringManAI>(currentLevel);
}
}
internal class DeliveryEvent : ILethalEvent
{
void ILethalEvent.Execute(SelectableLevel currentLevel)
{
Terminal val = Object.FindObjectOfType<Terminal>();
int num = Random.Range(LethalEventsState.Config.MinDeliveryItems.Value, LethalEventsState.Config.MaxDeliveryItems.Value);
for (int i = 0; i < num; i++)
{
int item = Random.Range(0, 7);
if (LethalEventsState.Config.ChanceForHighTierDeliveryItems.Value > Random.Range(0, 100))
{
item = Random.Range(7, 12);
}
val.orderedItemsFromTerminal.Add(item);
}
}
}
internal interface ILethalEvent
{
internal void Execute(SelectableLevel currentLevel);
}
internal enum LethalEvent
{
[Description("<color=green>None")]
None,
[Description("<color=red>Turret Hell")]
TurretHell,
[Description("<color=red>Mine Hell")]
MineHell,
[Description("<color=red>Arachnophobia")]
Arachnophobia,
[Description("<color=red>Look Up")]
SnareFleas,
[Description("<color=red>The Worst Combo")]
BrackenAndCoilhead,
[Description("<color=red>Slime City")]
SlimeCity,
[Description("<color=red>Lootbug Haven")]
LootbugHaven,
[Description("<color=green>Free delivery!")]
Delivery
}
internal class LootbugHavenEvent : ILethalEvent
{
void ILethalEvent.Execute(SelectableLevel currentLevel)
{
LethalEventHandler.SetEnemiesRarity<HoarderBugAI>(currentLevel);
}
}
internal class TurretHellEvent : ILethalEvent
{
void ILethalEvent.Execute(SelectableLevel currentLevel)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
SpawnableMapObject[] spawnableMapObjects = currentLevel.spawnableMapObjects;
foreach (SpawnableMapObject val in spawnableMapObjects)
{
if ((Object)(object)val.prefabToSpawn.GetComponentInChildren<Turret>() != (Object)null)
{
val.numberToSpawn = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, (float)Random.Range(LethalEventsState.Config.MinMines.Value, LethalEventsState.Config.MaxMines.Value)),
new Keyframe(1f, 25f)
});
}
}
}
}
internal class NoneEvent : ILethalEvent
{
void ILethalEvent.Execute(SelectableLevel currentLevel)
{
LELogger.Mls.LogMessage((object)"Nothing happens");
}
}
internal class SlimeCityEvent : ILethalEvent
{
void ILethalEvent.Execute(SelectableLevel currentLevel)
{
LethalEventHandler.SetEnemiesRarity<BlobAI>(currentLevel);
}
}
internal class SnareFleaEvent : ILethalEvent
{
void ILethalEvent.Execute(SelectableLevel currentLevel)
{
LethalEventHandler.SetEnemiesRarity<CentipedeAI>(currentLevel);
}
}
internal class MineHellEvent : ILethalEvent
{
void ILethalEvent.Execute(SelectableLevel currentLevel)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
SpawnableMapObject[] spawnableMapObjects = currentLevel.spawnableMapObjects;
foreach (SpawnableMapObject val in spawnableMapObjects)
{
if ((Object)(object)val.prefabToSpawn.GetComponentInChildren<Landmine>() != (Object)null)
{
val.numberToSpawn = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, (float)Random.Range(LethalEventsState.Config.MinTurrets.Value, LethalEventsState.Config.MaxTurrets.Value)),
new Keyframe(1f, 25f)
});
}
}
}
}
}
namespace LethalEvents.Configuration
{
internal static class LethalConfig
{
private static string _generalSection = "1. General Settings";
private static string _turretHellSection = "2. Turret Hell";
private static string _mineHellSection = "3. Mine Hell";
private static string _arachnophobiaSection = "4. Arachnophobia";
private static string _slimeCitySection = "5. Arachnophobia";
private static string _snareFleasSection = "6. Snare Fles";
private static string _brackenAndCoildheadSection = "7. Bracken And Coilhead";
private static string _lootbugHavenSection = "8. Lootbug Haven";
private static string _deliverySection = "9. Delivery";
internal static LethalConfigDTO BindConfigSettings()
{
LethalConfigDTO lethalConfigDTO = new LethalConfigDTO();
lethalConfigDTO.LethalEventIsEnabled.Add(LethalEvent.None, ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<bool>(_generalSection, "EnableNoneEvent", true, "Enable 'None' event"));
lethalConfigDTO.MaxEnemyPowerIncrement = ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<int>(_generalSection, "MaxEnemyPowerIncrement", 5, "Additional available enemy power, added to every map (Most noticeable on early moons)");
lethalConfigDTO.LethalEventIsEnabled.Add(LethalEvent.TurretHell, ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<bool>(_turretHellSection, "EnableTurretHellEvent", true, "Enable 'Turret Hell' event (Spawns way too many turrets)"));
lethalConfigDTO.MinTurrets = ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<int>(_turretHellSection, "MinTurrets", 25, "Minimum amount of turrets during Turrent Hell event");
lethalConfigDTO.MaxTurrets = ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<int>(_turretHellSection, "MaxTurrets", 50, "Maximum amount of turrets during Turrent Hell event");
lethalConfigDTO.LethalEventIsEnabled.Add(LethalEvent.MineHell, ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<bool>(_mineHellSection, "EnableMineHellEvent", true, "Enable 'Mine Hell' event (Spawns way too many mines)"));
lethalConfigDTO.MinMines = ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<int>(_mineHellSection, "MinMines", 25, "Minimum amount of mines during Mine Hell event");
lethalConfigDTO.MaxMines = ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<int>(_mineHellSection, "MaxMines", 50, "Maximum amount of mines during Mine Hell event");
lethalConfigDTO.LethalEventIsEnabled.Add(LethalEvent.Arachnophobia, ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<bool>(_arachnophobiaSection, "EnableArachnophobiaEvent", true, "Enable 'Arachnophobia' event (Chance of enemies being spiders is drastically increased)"));
lethalConfigDTO.LethalEventIsEnabled.Add(LethalEvent.SlimeCity, ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<bool>(_slimeCitySection, "EnableSlimeCityEvent", true, "Enable 'Slime City' event (Chance of enemies being slimes is drastically increased)"));
lethalConfigDTO.LethalEventIsEnabled.Add(LethalEvent.SnareFleas, ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<bool>(_snareFleasSection, "EnableSnareFleasEvent", true, "Enable 'Snare Fleas' event (Chance of enemies being snare fleas is drastically increased)"));
lethalConfigDTO.LethalEventIsEnabled.Add(LethalEvent.BrackenAndCoilhead, ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<bool>(_brackenAndCoildheadSection, "EnableBrackenAndCoilheadEvent", true, "Enable 'BrackenAndCoilhead' event (Chance of enemies being bracken and coilheads is drastically increased)"));
lethalConfigDTO.LethalEventIsEnabled.Add(LethalEvent.LootbugHaven, ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<bool>(_lootbugHavenSection, "EnableLootbugHavenEvent", true, "Enable 'LootbugHaven' event (Chance of enemies being lootbugs is drastically increased)"));
lethalConfigDTO.LethalEventIsEnabled.Add(LethalEvent.Delivery, ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<bool>(_deliverySection, "EnableDeliveryEvent", true, "Enable 'Delivery' event (Delivers free items from the vanilla shop)"));
lethalConfigDTO.ChanceForHighTierDeliveryItems = ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<int>(_deliverySection, "ChanceForHighTierDeliverItems", 10, "Chance for a delivery item to be a high tier items during 'Delivery' event. (From 0-100%)");
lethalConfigDTO.MinDeliveryItems = ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<int>(_deliverySection, "MinDeliveryItems", 3, "Minimum amount of items delivered during 'Delivery' event");
lethalConfigDTO.MaxDeliveryItems = ((BaseUnityPlugin)LethalEvents.Instance).Config.Bind<int>(_deliverySection, "MaxDeliveryItems", 8, "Maximum amount of items delivered during 'Delivery' event");
return lethalConfigDTO;
}
}
internal class LethalConfigDTO
{
public Dictionary<LethalEvent, ConfigEntry<bool>> LethalEventIsEnabled { get; set; } = new Dictionary<LethalEvent, ConfigEntry<bool>>();
public ConfigEntry<int> MaxEnemyPowerIncrement { get; set; }
public ConfigEntry<int> MinTurrets { get; set; }
public ConfigEntry<int> MaxTurrets { get; set; }
public ConfigEntry<int> MinMines { get; set; }
public ConfigEntry<int> MaxMines { get; set; }
public ConfigEntry<int> ChanceForHighTierDeliveryItems { get; set; }
public ConfigEntry<int> MinDeliveryItems { get; set; }
public ConfigEntry<int> MaxDeliveryItems { get; set; }
}
}
namespace LethalEvents.Common
{
internal static class EnumExtensions
{
internal static string GetDescription(this Enum value)
{
Type type = value.GetType();
string name = Enum.GetName(type, value);
if (name != null)
{
FieldInfo field = type.GetField(name);
if (field != null && Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) is DescriptionAttribute descriptionAttribute)
{
return descriptionAttribute.Description;
}
}
return null;
}
}
internal static class LELogger
{
internal static ManualLogSource Mls { get; set; }
}
internal static class LethalEventHandler
{
private const int MOON_HEAT_MODIFIER = 20;
private const float ENEMY_EVENT_SPAWN_MULTIPIER = 5f;
internal static ILethalEvent GetLethalEventExecutor(LethalEvent lethalEvent)
{
return lethalEvent switch
{
LethalEvent.None => new NoneEvent(),
LethalEvent.TurretHell => new TurretHellEvent(),
LethalEvent.MineHell => new MineHellEvent(),
LethalEvent.Arachnophobia => new ArachnophobiaEvent(),
LethalEvent.SnareFleas => new SnareFleaEvent(),
LethalEvent.BrackenAndCoilhead => new BrackenAndCoilEvent(),
LethalEvent.SlimeCity => new SlimeCityEvent(),
LethalEvent.LootbugHaven => new LootbugHavenEvent(),
LethalEvent.Delivery => new DeliveryEvent(),
_ => new NoneEvent(),
};
}
internal static LethalEvent GetRandomLethalEvent(SelectableLevel currentLevel)
{
if (!LethalEventsState.Config.LethalEventIsEnabled.Where((KeyValuePair<LethalEvent, ConfigEntry<bool>> x) => x.Value.Value).Any())
{
return LethalEvent.None;
}
if (Random.Range(0, 100) >= LethalEventsState.MoonHeat[currentLevel.levelID] && LethalEventsState.Config.LethalEventIsEnabled[LethalEvent.None].Value)
{
return LethalEvent.None;
}
LethalEvent lethalEvent = (LethalEvent)Random.Range(0, Enum.GetValues(typeof(LethalEvent)).Length);
while (!LethalEventsState.Config.LethalEventIsEnabled[lethalEvent].Value)
{
lethalEvent = (LethalEvent)Random.Range(0, Enum.GetValues(typeof(LethalEvent)).Length);
}
return lethalEvent;
}
internal static void LogLethalEventName(LethalEvent lethalEvent)
{
LELogger.Mls.LogMessage((object)$"Current Event: {lethalEvent}");
HUDManager.Instance.AddTextToChatOnServer("<color=orange>CURRENT EVENT: " + lethalEvent.GetDescription(), -1);
}
internal static void LogCurrentMoonHeat(SelectableLevel currentLevel)
{
LELogger.Mls.LogMessage((object)$"Current Moon Heat: {LethalEventsState.MoonHeat[currentLevel.levelID]}");
HUDManager.Instance.AddTextToChatOnServer($"<color=purple>Current Moon Heat: {LethalEventsState.MoonHeat[currentLevel.levelID]}", -1);
}
internal static void NormalizeLevel(SelectableLevel currentLevel)
{
NormalizeMoon(currentLevel);
NormalizeEnemiesRarities(currentLevel);
NormalizeSpawnableMapObjectsCurves(currentLevel);
}
internal static void NormalizeMoon(SelectableLevel currentLevel)
{
if (!LethalEventsState.OriginalMaxEnemyPowerCount.ContainsKey(currentLevel))
{
LethalEventsState.OriginalMaxEnemyPowerCount[currentLevel] = currentLevel.maxEnemyPowerCount;
}
else
{
currentLevel.maxEnemyPowerCount = LethalEventsState.OriginalMaxEnemyPowerCount[currentLevel];
}
}
internal static void NormalizeEnemiesRarities(SelectableLevel currentLevel)
{
if (!LethalEventsState.OriginalEnemiesRarities.ContainsKey(currentLevel))
{
List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>(((IEnumerable<SpawnableEnemyWithRarity>)currentLevel.Enemies).Select((Func<SpawnableEnemyWithRarity, SpawnableEnemyWithRarity>)((SpawnableEnemyWithRarity e) => new SpawnableEnemyWithRarity
{
enemyType = e.enemyType,
rarity = e.rarity
})));
Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>> originalEnemiesRarities = LethalEventsState.OriginalEnemiesRarities;
List<SpawnableEnemyWithRarity> list2 = new List<SpawnableEnemyWithRarity>(list.Count);
foreach (SpawnableEnemyWithRarity item in list)
{
list2.Add(item);
}
originalEnemiesRarities[currentLevel] = list2;
return;
}
foreach (SpawnableEnemyWithRarity enemy in currentLevel.Enemies)
{
SpawnableEnemyWithRarity val = ((IEnumerable<SpawnableEnemyWithRarity>)LethalEventsState.OriginalEnemiesRarities[currentLevel]).FirstOrDefault((Func<SpawnableEnemyWithRarity, bool>)((SpawnableEnemyWithRarity x) => x.enemyType.enemyName == enemy.enemyType.enemyName));
if (val != null)
{
enemy.rarity = val.rarity;
}
}
}
internal static void NormalizeSpawnableMapObjectsCurves(SelectableLevel currentLevel)
{
if (!LethalEventsState.OriginalMapObjectCurve.ContainsKey(currentLevel))
{
List<SpawnableMapObject> list = new List<SpawnableMapObject>(((IEnumerable<SpawnableMapObject>)currentLevel.spawnableMapObjects).Select((Func<SpawnableMapObject, SpawnableMapObject>)((SpawnableMapObject e) => new SpawnableMapObject
{
prefabToSpawn = e.prefabToSpawn,
numberToSpawn = e.numberToSpawn
})));
Dictionary<SelectableLevel, List<SpawnableMapObject>> originalMapObjectCurve = LethalEventsState.OriginalMapObjectCurve;
List<SpawnableMapObject> list2 = new List<SpawnableMapObject>(list.Count);
foreach (SpawnableMapObject item in list)
{
list2.Add(item);
}
originalMapObjectCurve[currentLevel] = list2;
return;
}
SpawnableMapObject[] spawnableMapObjects = currentLevel.spawnableMapObjects;
foreach (SpawnableMapObject mapObject in spawnableMapObjects)
{
SpawnableMapObject val = ((IEnumerable<SpawnableMapObject>)LethalEventsState.OriginalMapObjectCurve[currentLevel]).FirstOrDefault((Func<SpawnableMapObject, bool>)((SpawnableMapObject x) => ((Object)x.prefabToSpawn).name == ((Object)mapObject.prefabToSpawn).name));
if (val != null)
{
mapObject.numberToSpawn = val.numberToSpawn;
}
}
}
internal static void HandleMoonHeat(SelectableLevel currentLevel)
{
if (!LethalEventsState.MoonHeat.ContainsKey(currentLevel.levelID))
{
LethalEventsState.MoonHeat.Add(currentLevel.levelID, 0);
}
foreach (KeyValuePair<int, int> item in LethalEventsState.MoonHeat.ToList())
{
if (item.Key == currentLevel.levelID)
{
LethalEventsState.MoonHeat[item.Key] += 20;
if (LethalEventsState.MoonHeat[item.Key] > 100)
{
LethalEventsState.MoonHeat[item.Key] = 100;
}
}
else
{
LethalEventsState.MoonHeat[item.Key] -= 20;
if (LethalEventsState.MoonHeat[item.Key] < 0)
{
LethalEventsState.MoonHeat[item.Key] = 0;
}
}
}
}
internal static void SetEnemiesRarity<T>(SelectableLevel currentLevel) where T : EnemyAI
{
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: 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_0183: Expected O, but got Unknown
LELogger.Mls.LogMessage((object)$"MoonHeat: {LethalEventsState.MoonHeat[currentLevel.levelID]} | MoonHeatModifier: {20} | Divided: {LethalEventsState.MoonHeat[currentLevel.levelID] / 20}");
float num = 5f * (float)(LethalEventsState.MoonHeat[currentLevel.levelID] / 20);
LELogger.Mls.LogMessage((object)$"Enemy Multiplier: {num}");
for (int i = 0; i < currentLevel.Enemies.Count; i++)
{
SpawnableEnemyWithRarity val = currentLevel.Enemies[i];
if ((Object)(object)val.enemyType.enemyPrefab.GetComponent<T>() != (Object)null)
{
int rarity = val.rarity;
SpawnableEnemyWithRarity obj = currentLevel.Enemies[i];
obj.rarity += (int)Math.Round((float)rarity * num);
currentLevel.Enemies[i].enemyType.MaxCount = (int)Math.Round((float)rarity * num);
float[] array = new float[2]
{
1f,
40f + num
};
float[] array2 = new float[2]
{
100f,
100f + num
};
Keyframe[] array3 = (Keyframe[])(object)new Keyframe[array.Length];
for (int j = 0; j < array.Length; j++)
{
array3[j] = new Keyframe(array[j], array2[j]);
}
currentLevel.Enemies[i].enemyType.probabilityCurve = new AnimationCurve(array3);
}
}
}
}
internal static class LethalEventsState
{
internal static Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>> OriginalEnemiesRarities { get; set; } = new Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>>();
internal static Dictionary<SelectableLevel, List<SpawnableMapObject>> OriginalMapObjectCurve { get; set; } = new Dictionary<SelectableLevel, List<SpawnableMapObject>>();
internal static Dictionary<SelectableLevel, int> OriginalMaxEnemyPowerCount { get; set; } = new Dictionary<SelectableLevel, int>();
internal static Dictionary<int, int> MoonHeat { get; set; } = new Dictionary<int, int>();
internal static bool IsHost { get; set; } = false;
internal static bool EnableGod { get; set; } = false;
internal static bool EnableNightVision { get; set; } = false;
internal static bool EnableInfiniteSprint { get; set; } = false;
internal static LethalConfigDTO Config { get; set; }
}
}