using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Randomizer.Patches;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("LethalCompanyRandomizer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A Randomizer for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalCompanyRandomizer")]
[assembly: AssemblyTitle("LethalCompanyRandomizer")]
[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 LethalCompanyRandomizer
{
[BepInPlugin("Randomizer", "Lethal Company Randomizer", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private const string PLUGIN_GUID = "Randomizer";
private const string PLUGIN_NAME = "Lethal Company Randomizer";
private const string PLUGIN_VERSION = "1.0.0";
private readonly Harmony harmony = new Harmony("Randomizer");
private void Awake()
{
Debug.Log((object)"I'm a cowboy");
harmony.PatchAll(typeof(changescrap));
harmony.PatchAll(typeof(changemapobjects));
harmony.PatchAll(typeof(changeoutsideenemies));
harmony.PatchAll(typeof(ChangeInsideEnemies));
harmony.PatchAll(typeof(ChangeText));
}
}
}
namespace Randomizer
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "LethalCompanyRandomizer";
public const string PLUGIN_NAME = "LethalCompanyRandomizer";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace Randomizer.Patches
{
public class changescrap
{
public static SelectableLevel PickedLevel;
[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
[HarmonyPrefix]
public static void RandomizeScrap(RoundManager __instance)
{
Random random = new Random();
int num = random.Next(0, __instance.playersManager.levels.Length);
while (__instance.playersManager.levels[num].PlanetName == "71 Gordion")
{
int num2 = random.Next(0, __instance.playersManager.levels.Length);
num = num2;
}
__instance.currentLevel = __instance.playersManager.levels[num];
PickedLevel = __instance.currentLevel;
}
}
public class changemapobjects
{
[HarmonyPatch(typeof(RoundManager), "SpawnMapObjects")]
[HarmonyPrefix]
public static void changeLevel(RoundManager __instance)
{
SelectableLevel pickedLevel = changescrap.PickedLevel;
__instance.currentLevel = pickedLevel;
}
}
public class changeoutsideenemies
{
public static SelectableLevel ORLevel = RandomLevel();
public static SelectableLevel RandomLevel()
{
Random random = new Random();
int num = random.Next(0, RoundManager.Instance.playersManager.levels.Length);
return RoundManager.Instance.playersManager.levels[num];
}
[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
[HarmonyPrefix]
public static void ChangeRandomNumber(RoundManager __instance)
{
ORLevel = RandomLevel();
}
[HarmonyPatch(typeof(RoundManager), "PredictAllOutsideEnemies")]
[HarmonyPrefix]
public static void ChangeOutsideEnemies(RoundManager __instance)
{
__instance.currentLevel = ORLevel;
Debug.Log((object)("Outside Enemies: " + __instance.currentLevel.PlanetName));
}
[HarmonyPatch(typeof(RoundManager), "SpawnEnemiesOutside")]
[HarmonyPrefix]
public static void SpawnOutsideEnemies(RoundManager __instance)
{
__instance.currentLevel = ORLevel;
Debug.Log((object)("Outside Enemies: " + __instance.currentLevel.PlanetName));
}
[HarmonyPatch(typeof(RoundManager), "SpawnRandomOutsideEnemy")]
[HarmonyPrefix]
public static void SpawnOutsideEnemy(RoundManager __instance)
{
__instance.currentLevel = ORLevel;
}
[HarmonyPatch(typeof(RoundManager), "RefreshEnemiesList")]
[HarmonyPrefix]
public static void RefreshEnemyList(RoundManager __instance)
{
__instance.currentLevel.maxOutsideEnemyPowerCount = ORLevel.maxOutsideEnemyPowerCount;
}
}
public class ChangeInsideEnemies
{
public static SelectableLevel RLevel = RandomLevel();
public static SelectableLevel RandomLevel()
{
Random random = new Random();
int num = random.Next(0, RoundManager.Instance.playersManager.levels.Length);
return RoundManager.Instance.playersManager.levels[num];
}
[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
[HarmonyPrefix]
public static void ChangeRandomNumber(RoundManager __instance)
{
RLevel = RandomLevel();
}
[HarmonyPatch(typeof(RoundManager), "PlotOutEnemiesForNextHour")]
[HarmonyPrefix]
public static void PlotOutEnemiesForNextHour(RoundManager __instance)
{
__instance.currentLevel = RLevel;
}
[HarmonyPatch(typeof(RoundManager), "AssignRandomEnemyToVent")]
[HarmonyPrefix]
public static void AssignRandomEnemyToVent(RoundManager __instance)
{
__instance.currentLevel = RLevel;
}
[HarmonyPatch(typeof(RoundManager), "EnemyCannotBeSpawned")]
[HarmonyPrefix]
public static void EnemyCannotBeSpawned(RoundManager __instance)
{
__instance.currentLevel = RLevel;
}
[HarmonyPatch(typeof(RoundManager), "BeginEnemySpawning")]
[HarmonyPrefix]
public static void BeginEnemySpawning(RoundManager __instance)
{
__instance.currentLevel = RLevel;
}
[HarmonyPatch(typeof(RoundManager), "RefreshEnemiesList")]
[HarmonyPrefix]
public static void RefreshEnemyList(RoundManager __instance)
{
__instance.currentLevel.maxEnemyPowerCount = RLevel.maxEnemyPowerCount;
}
}
public class ChangeText
{
[HarmonyPatch(typeof(StartOfRound), "WritePlayerNotes")]
[HarmonyPostfix]
public static void Update(StartOfRound __instance)
{
try
{
__instance.gameStats.allPlayerStats[0].playerNotes.Clear();
__instance.gameStats.allPlayerStats[0].playerNotes.Add("S:" + changescrap.PickedLevel.PlanetName);
__instance.gameStats.allPlayerStats[0].playerNotes.Add("IE:" + ChangeInsideEnemies.RLevel.PlanetName);
__instance.gameStats.allPlayerStats[0].playerNotes.Add("OE:" + changeoutsideenemies.ORLevel.PlanetName);
}
catch (Exception ex)
{
Debug.Log((object)ex);
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}