using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LassoManMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LassoManMod")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d0463125-218d-41f5-b4d9-1a0ec1382ac4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LassoManMod
{
[BepInPlugin("LassoManMod", "LassoManMod", "1.0.0")]
public class LassoManBase : BaseUnityPlugin
{
private static LassoManBase Instance;
private static ManualLogSource mls = Logger.CreateLogSource("LassoManMod");
private Harmony harmony = new Harmony("LassoManMod");
public static bool IsDebugging = true;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
harmony.PatchAll();
LogInfo("Plugin has loaded");
SetupConfig();
}
private void SetupConfig()
{
Variables.CanSpawn = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Can Spawn", true, "Can Lasso Man spawn?").Value;
Variables.LassoManAmount = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Max Amount", 1, "How many Lasso Men can spawn at once?").Value;
Variables.SpawnRarity = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Spawn Rarity", 5, "How rare is the encounter with Lasso Man?").Value;
Variables.PowerLevel = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Power Level", 2, "What is his power level?").Value;
IsDebugging = ((BaseUnityPlugin)this).Config.Bind<bool>("Debugging", "Message Logging", true, "Do you want the debug messages?").Value;
}
public static void LogInfo(object data)
{
if (IsDebugging)
{
mls.LogInfo(data);
}
}
public static void LogWarning(object data)
{
if (IsDebugging)
{
mls.LogWarning(data);
}
}
public static void LogError(object data)
{
if (IsDebugging)
{
mls.LogError(data);
}
}
}
public class PluginInfo
{
public const string PLUGIN_GUID = "LassoManMod";
public const string PLUGIN_NAME = "LassoManMod";
public const string PLUGIN_VERSION = "1.0.0";
}
public class Variables
{
public static bool CanSpawn;
public static int SpawnRarity;
public static int LassoManAmount;
public static int PowerLevel;
}
}
namespace LassoManMod.Patches
{
[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
internal class RoundManagerPatch
{
public static void Prefix(ref SelectableLevel newLevel)
{
//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_01b7: 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_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Expected O, but got Unknown
if (!Variables.CanSpawn)
{
return;
}
bool flag = false;
foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies)
{
if ((Object)(object)enemy.enemyType.enemyPrefab.GetComponent<LassoManAI>() != (Object)null)
{
flag = true;
break;
}
}
if (!flag)
{
SelectableLevel[] levels = StartOfRound.Instance.levels;
foreach (SelectableLevel val in levels)
{
foreach (SpawnableEnemyWithRarity enemy2 in val.Enemies)
{
if ((Object)(object)enemy2.enemyType.enemyPrefab.GetComponent<LassoManAI>() != (Object)null)
{
newLevel.Enemies.Add(enemy2);
LassoManBase.LogInfo("Spawned Lasso Man.");
flag = true;
break;
}
}
if (flag)
{
break;
}
}
}
foreach (SpawnableEnemyWithRarity enemy3 in newLevel.Enemies)
{
if ((Object)(object)enemy3.enemyType.enemyPrefab.GetComponent<LassoManAI>() != (Object)null)
{
enemy3.rarity = Variables.SpawnRarity;
enemy3.enemyType.PowerLevel = 2;
enemy3.enemyType.MaxCount = Variables.LassoManAmount;
enemy3.enemyType.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 45f)
});
}
}
}
}
}