using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("TestMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestMod")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("740c49b2-3305-43e9-bd2b-1ad8041358f0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TestMod;
internal class Patch
{
[HarmonyPatch(typeof(Terminal))]
public class TerminalPatch
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
public static void Awake(ref Terminal __instance)
{
if ((Object)(object)__instance != (Object)null)
{
Item[] buyableItemsList = __instance.buyableItemsList;
foreach (Item obj in buyableItemsList)
{
obj.creditsWorth = 0;
obj.weight = 0f;
}
}
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
public class PlayerControllerBPatch
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
public static void Awake(ref PlayerControllerB __instance)
{
if ((Object)(object)__instance != (Object)null)
{
PlayerControllerB obj = __instance;
obj.movementSpeed *= 2f;
}
}
[HarmonyPatch("AllowPlayerDeath")]
[HarmonyPrefix]
public static void AllowPlayerDeath(ref PlayerControllerB __instance)
{
if ((Object)(object)__instance != (Object)null)
{
StartOfRound.Instance.allowLocalPlayerDeath = false;
}
}
}
[HarmonyPatch(typeof(RoundManager))]
public class RoundManagerPatch
{
[HarmonyPatch("SpawnScrapInLevel")]
[HarmonyPrefix]
public static void Awake(ref RoundManager __instance)
{
if ((Object)(object)__instance != (Object)null)
{
__instance.scrapValueMultiplier = 10f;
__instance.scrapAmountMultiplier = 10f;
}
}
[HarmonyPatch("LoadNewLevel")]
[HarmonyPostfix]
public static void LoadNewLevel(ref RoundManager __instance)
{
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Expected O, but got Unknown
if (!((Object)(object)__instance != (Object)null))
{
return;
}
SelectableLevel currentLevel = __instance.currentLevel;
currentLevel.DaySpeedMultiplier *= 4f;
currentLevel.Enemies.AddRange(currentLevel.OutsideEnemies.Where((SpawnableEnemyWithRarity e) => !currentLevel.Enemies.Contains(e)));
currentLevel.Enemies.AddRange(currentLevel.DaytimeEnemies.Where((SpawnableEnemyWithRarity e) => !currentLevel.Enemies.Contains(e)));
currentLevel.OutsideEnemies = currentLevel.Enemies;
currentLevel.DaytimeEnemies = currentLevel.Enemies;
int num = 1000;
RoundManager obj = __instance;
obj.minEnemiesToSpawn *= num;
RoundManager obj2 = __instance;
obj2.minOutsideEnemiesToSpawn *= num;
SelectableLevel obj3 = currentLevel;
obj3.maxEnemyPowerCount *= num;
SelectableLevel obj4 = currentLevel;
obj4.maxOutsideEnemyPowerCount *= num;
SelectableLevel obj5 = currentLevel;
obj5.maxDaytimeEnemyPowerCount *= num;
currentLevel.Enemies.Add(new SpawnableEnemyWithRarity());
List<SpawnableEnemyWithRarity>[] array = new List<SpawnableEnemyWithRarity>[3] { currentLevel.Enemies, currentLevel.OutsideEnemies, currentLevel.DaytimeEnemies };
for (int i = 0; i < array.Length; i++)
{
foreach (SpawnableEnemyWithRarity item in array[i])
{
switch (((Object)item.enemyType).name)
{
case "HoarderBug":
case "Nutcracker":
case "SandSpider":
case "BaboonHawk":
case "Doublewing":
case "Centipede":
case "DressGirl":
case "Flowerman":
case "SpringMan":
case "Jester":
case "Puffer":
case "LassoMan":
case "MouthDog":
case "SandWorm":
case "Blob":
case "Crawler":
case "DocileLocustBees":
case "ForestGiant":
case "MaskedPlayerEnemy":
case "RedLocustBees":
item.rarity = 100;
break;
}
}
}
}
}
}
[BepInPlugin("TestMod.Plugin", "TestMod", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private const string modGUID = "TestMod.Plugin";
private const string modName = "TestMod";
private const string modVersion = "1.0.0";
internal static readonly ManualLogSource mls = Logger.CreateLogSource("TestMod.Plugin");
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("TestMod.Plugin").PatchAll(Assembly.GetExecutingAssembly());
}
}