using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LootClicker.Maps;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("CantStopWontStop")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CantStopWontStop")]
[assembly: AssemblyTitle("CantStopWontStop")]
[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 CantStopWontStop
{
public static class EndlessCapPatches
{
private const int OldCap = 999;
private static readonly int NewCap = 9999;
public static void Apply(Harmony harmony)
{
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Expected O, but got Unknown
(MethodBase, string)[] obj = new(MethodBase, string)[4]
{
(typeof(EndlessMap).GetConstructor(BindingFlags.Instance | BindingFlags.Public, null, Type.EmptyTypes, null), "EndlessMap..ctor"),
(typeof(EndlessSpires).GetConstructor(BindingFlags.Instance | BindingFlags.Public, null, Type.EmptyTypes, null), "EndlessSpires..ctor"),
(typeof(EndlessMap).GetMethod("UpdateMaxLevelCleared", BindingFlags.Instance | BindingFlags.Public), "UpdateMaxLevelCleared"),
(typeof(EndlessMap).GetMethod("UpdateMaxLevelAvailable", BindingFlags.Instance | BindingFlags.Public), "UpdateMaxLevelAvailable")
};
HarmonyMethod val = new HarmonyMethod(typeof(EndlessCapPatches).GetMethod("ReplaceCap", BindingFlags.Static | BindingFlags.Public));
(MethodBase, string)[] array = obj;
for (int i = 0; i < array.Length; i++)
{
(MethodBase, string) tuple = array[i];
if (tuple.Item1 != null)
{
harmony.Patch(tuple.Item1, (HarmonyMethod)null, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null);
CantStopWontStopPlugin.Log.LogInfo((object)("Patched " + tuple.Item2));
}
else
{
CantStopWontStopPlugin.Log.LogWarning((object)("Could not find " + tuple.Item2));
}
}
}
public static IEnumerable<CodeInstruction> ReplaceCap(IEnumerable<CodeInstruction> instructions)
{
foreach (CodeInstruction instruction in instructions)
{
if (instruction.opcode == OpCodes.Ldc_I4 && instruction.operand is int num && num == 999)
{
instruction.operand = NewCap;
}
yield return instruction;
}
}
}
[BepInPlugin("com.corga.cantstopwontstop", "CantStopWontStop", "1.0.0")]
public class CantStopWontStopPlugin : BaseUnityPlugin
{
public const string PluginGUID = "com.corga.cantstopwontstop";
public const string PluginName = "CantStopWontStop";
public const string PluginVersion = "1.0.0";
internal static ManualLogSource Log;
public const int NewCap = 9999;
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
EndlessCapPatches.Apply(new Harmony("com.corga.cantstopwontstop"));
Log.LogInfo((object)$"Can't stop, won't stop — endless cap raised from 999 to {9999}");
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}