using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib;
using REPOLib.Modules;
using RepoRush.BadEvents;
using RepoRush.GoodEvents;
using RepoRush.Match1;
using RepoRush.MiscEvents;
using UnityEngine;
using UnityEngine.Events;
[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("Repo Rush")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.2.2")]
[assembly: AssemblyInformationalVersion("0.2.2+652bc2ffd8e695db4a46fb65830e9c150f21d7af")]
[assembly: AssemblyProduct("Repo Rush")]
[assembly: AssemblyTitle("Repo Rush")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.2.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 RepoRush
{
[BepInPlugin("dev.redfops.repo.reporush", "Repo Rush", "0.2.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public const string modGUID = "dev.redfops.repo.reporush";
public const string modName = "Repo Rush";
public const string modVersion = "0.2.2";
internal static ManualLogSource Logger;
private readonly Harmony harmony = new Harmony("dev.redfops.repo.reporush");
public static ConfigEntry<bool> match1Enabled;
public static ConfigEntry<bool> match2Enabled;
public static ConfigEntry<bool> match3Enabled;
public static ConfigEntry<bool> match4Enabled;
public static ConfigEntry<bool> matchFinalEnabled;
public static ConfigEntry<bool> eventDiscountedShop;
public static ConfigEntry<bool> mcJannekOnly;
public static ConfigEntry<bool> easierExtraction;
public static ConfigEntry<bool> potentUpgrades;
public static ConfigEntry<bool> eventSneaky;
public static ConfigEntry<bool> manorOnly;
public static ConfigEntry<bool> shopless;
public static ConfigEntry<bool> extraEnemy;
public static ConfigEntry<bool> extraExtraction;
public static ConfigEntry<bool> eventSpeedy;
public static ConfigEntry<bool> stalker;
public static ConfigEntry<bool> squeakyShoes;
private void Awake()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Expected O, but got Unknown
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Expected O, but got Unknown
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Expected O, but got Unknown
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Expected O, but got Unknown
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Expected O, but got Unknown
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Expected O, but got Unknown
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Expected O, but got Unknown
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Expected O, but got Unknown
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02b1: Expected O, but got Unknown
//IL_036c: Unknown result type (might be due to invalid IL or missing references)
//IL_0376: Expected O, but got Unknown
//IL_0397: Unknown result type (might be due to invalid IL or missing references)
//IL_03a1: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
match1Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Matches", "Match 1 enabled", true, new ConfigDescription("Enable custom effects for match 1", (AcceptableValueBase)null, Array.Empty<object>()));
harmony.PatchAll(typeof(PlayerUpdatePatch));
harmony.PatchAll(typeof(TumbleUpdatePatch));
harmony.PatchAll(typeof(TumbleForcePatch));
harmony.PatchAll(typeof(PhysGrabObjectAwakePatch));
harmony.PatchAll(typeof(PhysGrabObjectUpdatePatch));
eventDiscountedShop = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Events", "Discounted Shop", false, new ConfigDescription("Enable discounted shop event", (AcceptableValueBase)null, Array.Empty<object>()));
mcJannekOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Events", "McJannek Only", false, new ConfigDescription("Enable McJannek only event", (AcceptableValueBase)null, Array.Empty<object>()));
easierExtraction = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Events", "Lower Extraction", false, new ConfigDescription("Enable lower extraction event", (AcceptableValueBase)null, Array.Empty<object>()));
potentUpgrades = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Events", "Potent Upgrades", false, new ConfigDescription("Enable Potent Upgrades event", (AcceptableValueBase)null, Array.Empty<object>()));
eventSneaky = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Events", "Sneak 100", false, new ConfigDescription("Enable sneak 100 event", (AcceptableValueBase)null, Array.Empty<object>()));
harmony.PatchAll(typeof(ShopInitializePatch));
harmony.PatchAll(typeof(RepoRush.GoodEvents.RunManagerSetRunLevelPatch));
harmony.PatchAll(typeof(HaulGoalSetPatch));
harmony.PatchAll(typeof(PlayerUpgradePatch));
harmony.PatchAll(typeof(VisionTriggerPatch));
manorOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Events", "Manor Only", false, new ConfigDescription("Enable manor only event", (AcceptableValueBase)null, Array.Empty<object>()));
shopless = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Events", "Shopless", false, new ConfigDescription("Enable shopless event", (AcceptableValueBase)null, Array.Empty<object>()));
extraEnemy = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Events", "Increased spawns", false, new ConfigDescription("Enable increased spawns event", (AcceptableValueBase)null, Array.Empty<object>()));
extraExtraction = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Events", "Extra extraction", false, new ConfigDescription("Enable extra extraction event", (AcceptableValueBase)null, Array.Empty<object>()));
eventSpeedy = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Events", "Increased Speed", false, new ConfigDescription("Enable increased speed event", (AcceptableValueBase)null, Array.Empty<object>()));
eventSpeedy.SettingChanged += delegate
{
Time.timeScale = (eventSpeedy.Value ? 1.2f : 1f);
};
Time.timeScale = (eventSpeedy.Value ? 1.2f : 1f);
harmony.PatchAll(typeof(RepoRush.BadEvents.RunManagerSetRunLevelPatch));
harmony.PatchAll(typeof(ChangeLevelPatch));
harmony.PatchAll(typeof(RepoRush.BadEvents.EnemyAmountSetupPatch));
harmony.PatchAll(typeof(TileGenerationPatch));
stalker = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc Events", "They stalk you", false, new ConfigDescription("Enable they stalk you event", (AcceptableValueBase)null, Array.Empty<object>()));
squeakyShoes = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc Events", "Squeaky Shoes", false, new ConfigDescription("Enable squeaky shoes event", (AcceptableValueBase)null, Array.Empty<object>()));
Assets.LoadAssets();
harmony.PatchAll(typeof(PlayerSpawnPatch));
harmony.PatchAll(typeof(RepoRush.MiscEvents.EnemyAmountSetupPatch));
Logger.LogInfo((object)"Plugin Repo Rush is loaded!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Repo Rush";
public const string PLUGIN_NAME = "Repo Rush";
public const string PLUGIN_VERSION = "0.2.2";
}
}
namespace RepoRush.MiscEvents
{
internal static class Assets
{
internal static GameObject squeakerPrefab;
internal static AudioClip squeak1;
internal static AudioClip squeak2;
internal static AudioClip fart;
internal static GameObject stalkerPrefab;
internal static EnemySetup stalkerSetup;
internal static void LoadAssets()
{
string? directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
BundleLoader.LoadBundle(Path.Combine(directoryName, "squeak"), (Action<AssetBundle>)delegate(AssetBundle assetBundle)
{
squeakerPrefab = assetBundle.LoadAsset<GameObject>("Squeaker");
Plugin.Logger.LogMessage((object)squeakerPrefab);
NetworkPrefabs.RegisterNetworkPrefab("Reporush/squeaker", squeakerPrefab);
squeak1 = assetBundle.LoadAsset<AudioClip>("clownstep1");
squeak2 = assetBundle.LoadAsset<AudioClip>("clownstep2");
fart = assetBundle.LoadAsset<AudioClip>("clowncar_fart");
}, false);
BundleLoader.LoadBundle(Path.Combine(directoryName, "misc"), (Action<AssetBundle>)delegate(AssetBundle assetBundle)
{
stalkerSetup = assetBundle.LoadAsset<EnemySetup>("Stalker");
stalkerPrefab = assetBundle.LoadAsset<GameObject>("StalkerPrefab");
NetworkPrefabs.RegisterNetworkPrefab("Enemies/StalkerPrefab", stalkerPrefab);
}, false);
}
}
[HarmonyPatch(typeof(EnemyDirector))]
[HarmonyPatch("AmountSetup")]
public static class EnemyAmountSetupPatch
{
private static void Postfix(ref int ___totalAmount, ref List<EnemySetup> ___enemyList)
{
if (Plugin.stalker.Value)
{
___totalAmount++;
___enemyList.Add(Assets.stalkerSetup);
}
}
}
[HarmonyPatch(typeof(PlayerAvatar))]
[HarmonyPatch("SpawnRPC")]
internal static class PlayerSpawnPatch
{
private static void Postfix(PlayerAvatar __instance)
{
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.squeakyShoes.Value && (Plugin.matchFinalEnabled == null || !Plugin.matchFinalEnabled.Value))
{
return;
}
GameObject gameObject = ((Component)__instance).gameObject;
__instance.tumbleStartSound.Sounds = (AudioClip[])(object)new AudioClip[1] { Assets.fart };
__instance.tumbleStartSound.Volume = 0.6f;
if (SemiFunc.IsMultiplayer())
{
if (__instance.photonView.IsMine && !((Object)(object)((Component)__instance).gameObject.GetComponentInChildren<Squeaker>() != (Object)null))
{
PhotonNetwork.Instantiate("Reporush/squeaker", new Vector3(0f, 0f, 0f), Quaternion.identity, (byte)0, (object[])null);
}
}
else
{
((Behaviour)Object.Instantiate<GameObject>(Assets.squeakerPrefab, gameObject.transform).GetComponent<Squeaker>()).enabled = true;
}
}
}
public class Squeaker : MonoBehaviourPun, IPunInstantiateMagicCallback, IPunObservable
{
public Sound squeakSound;
private PlayerAvatar avatar;
private float squeakProgress;
private const float squeakPerSecond = 2.1f;
public void OnPhotonInstantiate(PhotonMessageInfo info)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
{
if (player.photonView.Owner == info.Sender)
{
((Component)((Component)this).transform).transform.SetParent(((Component)player).transform, false);
((Behaviour)this).enabled = true;
}
}
}
private void Start()
{
avatar = ((Component)((Component)this).transform.parent).GetComponent<PlayerAvatar>();
if ((Object)(object)avatar == (Object)null)
{
Plugin.Logger.LogError((object)"Avatar is null");
}
}
private void FixedUpdate()
{
if (SemiFunc.IsMultiplayer() && !avatar.photonView.IsMine)
{
return;
}
Traverse val = Traverse.Create((object)avatar);
if (!val.Field<bool>("isSliding").Value && !val.Field<bool>("isTumbling").Value && val.Field<bool>("isGrounded").Value)
{
float num = (val.Field<bool>("isCrouching").Value ? 0.63f : (val.Field<bool>("isSprinting").Value ? 1.5f : 1f));
squeakProgress += num * Time.fixedDeltaTime * ((Vector3)(ref PlayerController.instance.InputDirection)).magnitude;
if (squeakProgress > 0.4761905f)
{
squeakProgress = 0f;
PlaySqueak();
}
}
}
public void PlaySqueak()
{
if (GameManager.Multiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("PlaySqueakRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
PlaySqueakRPC();
}
}
[PunRPC]
public void PlaySqueakRPC()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
Traverse obj = Traverse.Create((object)avatar);
bool value = obj.Field<bool>("isCrouching").Value;
bool value2 = obj.Field<bool>("isSprinting").Value;
squeakSound.Play(((Component)this).transform.position, value ? 0.5f : (value2 ? 1.3f : 1f), 1f, 1f, 1f);
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
}
}
}
namespace RepoRush.Match1
{
[HarmonyPatch(typeof(PhysGrabObject))]
[HarmonyPatch("Awake")]
internal static class PhysGrabObjectAwakePatch
{
private static void Postfix(PhysGrabObject __instance, ref float ___angularDragOriginal, ref float ___dragOriginal, ref float ___massOriginal, ref float ___alterMassValue)
{
PlayerTumble component = ((Component)__instance).GetComponent<PlayerTumble>();
EnemyRigidbody component2 = ((Component)__instance).GetComponent<EnemyRigidbody>();
if (Plugin.match1Enabled.Value && !Object.op_Implicit((Object)(object)component) && !Object.op_Implicit((Object)(object)component2))
{
__instance.rb.angularDrag = 5f;
___angularDragOriginal = 5f;
__instance.rb.drag = 1f;
___dragOriginal = 1f;
__instance.rb.mass = 1f;
___massOriginal = 1f;
___alterMassValue = 1f;
}
}
}
[HarmonyPatch(typeof(PhysGrabObject))]
[HarmonyPatch("FixedUpdate")]
internal static class PhysGrabObjectUpdatePatch
{
private static void Postfix(PhysGrabObject __instance)
{
PlayerTumble component = ((Component)__instance).GetComponent<PlayerTumble>();
EnemyRigidbody component2 = ((Component)__instance).GetComponent<EnemyRigidbody>();
if (Plugin.match1Enabled.Value && !Object.op_Implicit((Object)(object)component) && !Object.op_Implicit((Object)(object)component2))
{
__instance.OverrideDrag(1f, 0.1f);
__instance.OverrideAngularDrag(5f, 0.1f);
__instance.OverrideMass(1f, 0.1f);
}
}
}
[HarmonyPatch(typeof(PlayerAvatar))]
[HarmonyPatch("Update")]
internal static class PlayerUpdatePatch
{
private static void Prefix(PlayerAvatar __instance)
{
if (LevelGenerator.Instance.Generated && Plugin.match1Enabled.Value)
{
PlayerController.instance.AntiGravity(1f);
}
}
}
[HarmonyPatch(typeof(PlayerTumble))]
[HarmonyPatch("TumbleForce")]
internal static class TumbleForcePatch
{
private static void Prefix(ref Vector3 _force)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
_force *= 2f;
}
}
[HarmonyPatch(typeof(PlayerTumble))]
[HarmonyPatch("Update")]
internal static class TumbleUpdatePatch
{
private static void Prefix(PhysGrabObject ___physGrabObject)
{
if (LevelGenerator.Instance.Generated && Plugin.match1Enabled.Value)
{
___physGrabObject.OverrideDrag(0.5f, 0.1f);
___physGrabObject.OverrideAngularDrag(0.5f, 0.1f);
___physGrabObject.OverrideZeroGravity(0.1f);
}
}
}
}
namespace RepoRush.GoodEvents
{
[HarmonyPatch(typeof(ExtractionPoint))]
[HarmonyPatch("HaulGoalSet")]
internal class HaulGoalSetPatch
{
private static void Prefix(ref int value)
{
value = (Plugin.easierExtraction.Value ? ((int)((float)value * 0.7f)) : value);
}
}
[HarmonyPatch(typeof(ItemUpgrade))]
[HarmonyPatch("PlayerUpgrade")]
internal class PlayerUpgradePatch
{
private static void Prefix(bool ___upgradeDone, UnityEvent ___upgradeEvent)
{
if (!(!Plugin.potentUpgrades.Value || ___upgradeDone))
{
___upgradeEvent.Invoke();
}
}
}
[HarmonyPatch(typeof(RunManager))]
[HarmonyPatch("SetRunLevel")]
internal class RunManagerSetRunLevelPatch
{
private static void Postfix(RunManager __instance)
{
if (Plugin.mcJannekOnly.Value)
{
__instance.levelCurrent = __instance.levels.First((Level x) => x.ResourcePath == "Arctic");
}
}
}
[HarmonyPatch(typeof(ShopManager))]
[HarmonyPatch("ShopInitialize")]
internal class ShopInitializePatch
{
private static void Postfix(ref float ___itemValueMultiplier)
{
___itemValueMultiplier = (Plugin.eventDiscountedShop.Value ? 2f : 4f);
}
}
[HarmonyPatch(typeof(EnemyVision))]
[HarmonyPatch("VisionTrigger")]
internal class VisionTriggerPatch
{
private static bool Prefix(PlayerAvatar player)
{
if (!Plugin.eventSneaky.Value)
{
return true;
}
if (!Traverse.Create((object)player).Field<bool>("isCrouching").Value)
{
return true;
}
return false;
}
}
}
namespace RepoRush.BadEvents
{
[HarmonyPatch(typeof(RunManager))]
[HarmonyPatch("ChangeLevel")]
internal class ChangeLevelPatch
{
private static void Prefix(bool _completedLevel, bool _levelFailed, ref ChangeLevelType _changeLevelType, RunManager __instance, bool ___restarting, ref Level ___previousRunLevel)
{
if (!((!SemiFunc.MenuLevel() && !SemiFunc.IsMasterClientOrSingleplayer()) || ___restarting || _levelFailed) && Plugin.shopless.Value)
{
if ((int)_changeLevelType == 5)
{
__instance.levelCurrent = __instance.levelShop;
_changeLevelType = (ChangeLevelType)0;
}
else if ((int)_changeLevelType == 0 && _completedLevel && (Object)(object)__instance.levelCurrent != (Object)(object)__instance.levelLobby && (Object)(object)__instance.levelCurrent != (Object)(object)__instance.levelShop)
{
___previousRunLevel = __instance.levelCurrent;
__instance.levelsCompleted++;
SemiFunc.StatSetRunLevel(__instance.levelsCompleted);
SemiFunc.LevelSuccessful();
__instance.levelCurrent = __instance.levelShop;
_changeLevelType = (ChangeLevelType)0;
}
}
}
}
[HarmonyPatch(typeof(EnemyDirector))]
[HarmonyPatch("AmountSetup")]
public static class EnemyAmountSetupPatch
{
private static void Postfix(ref int ___totalAmount, EnemyDirector __instance)
{
if (Plugin.extraEnemy.Value)
{
___totalAmount++;
List<EnemySetup> list = null;
switch (Random.RandomRangeInt(0, 3))
{
case 0:
list = __instance.enemiesDifficulty1;
break;
case 1:
list = __instance.enemiesDifficulty2;
break;
case 2:
list = __instance.enemiesDifficulty3;
break;
}
Traverse.Create((object)__instance).Method("PickEnemies", new Type[1] { typeof(List<EnemySetup>) }, (object[])null).GetValue(new object[1] { list });
}
}
}
[HarmonyPatch(typeof(RunManager))]
[HarmonyPatch("SetRunLevel")]
internal class RunManagerSetRunLevelPatch
{
private static void Postfix(RunManager __instance)
{
if (Plugin.manorOnly.Value)
{
__instance.levelCurrent = __instance.levels.First((Level x) => x.ResourcePath == "Manor");
}
}
}
[HarmonyPatch(typeof(LevelGenerator))]
public static class TileGenerationPatch
{
public static void IncrementExtractions()
{
if (Plugin.extraExtraction.Value)
{
Traverse val = Traverse.Create((object)LevelGenerator.Instance);
if (val.Field<int>("ModuleAmount").Value > 4)
{
Traverse<int> obj = val.Field<int>("ExtractionAmount");
int value = obj.Value;
obj.Value = value + 1;
}
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Expected O, but got Unknown
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
val.MatchStartForward((CodeMatch[])(object)new CodeMatch[4]
{
new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction x) => x.opcode == OpCodes.Br), (string)null),
new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction x) => x.opcode == OpCodes.Ldloc_1), (string)null),
new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction x) => x.opcode == OpCodes.Ldc_I4_0), (string)null),
new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction x) => CodeInstructionExtensions.StoresField(x, typeof(LevelGenerator).GetField("ExtractionAmount", BindingFlags.Instance | BindingFlags.NonPublic))), (string)null)
}).ThrowIfInvalid("Could not find marked spot in ILCode");
val.Advance(4);
val.Insert((CodeInstruction[])(object)new CodeInstruction[1] { CodeInstruction.Call((Expression<Action>)(() => IncrementExtractions())) });
Label label = default(Label);
val.AddLabels((IEnumerable<Label>)new <>z__ReadOnlySingleElementList<Label>(label));
val.Advance(1);
List<Label> oldLabels = val.Labels;
while (true)
{
val.MatchStartBackwards((CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction x) => x.operand is Label item && oldLabels.Contains(item)), (string)null)
});
if (val.IsInvalid)
{
break;
}
val.SetOperandAndAdvance((object)label);
}
return val.Instructions();
}
}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T>
{
object IEnumerator.Current => _item;
T IEnumerator<T>.Current => _item;
public Enumerator(T item)
{
_item = item;
}
bool IEnumerator.MoveNext()
{
if (!_moveNextCalled)
{
return _moveNextCalled = true;
}
return false;
}
void IEnumerator.Reset()
{
_moveNextCalled = false;
}
void IDisposable.Dispose()
{
}
}
int ICollection.Count => 1;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot => this;
object IList.this[int index]
{
get
{
if (index != 0)
{
throw new IndexOutOfRangeException();
}
return _item;
}
set
{
throw new NotSupportedException();
}
}
bool IList.IsFixedSize => true;
bool IList.IsReadOnly => true;
int IReadOnlyCollection<T>.Count => 1;
T IReadOnlyList<T>.this[int index]
{
get
{
if (index != 0)
{
throw new IndexOutOfRangeException();
}
return _item;
}
}
int ICollection<T>.Count => 1;
bool ICollection<T>.IsReadOnly => true;
T IList<T>.this[int index]
{
get
{
if (index != 0)
{
throw new IndexOutOfRangeException();
}
return _item;
}
set
{
throw new NotSupportedException();
}
}
public <>z__ReadOnlySingleElementList(T item)
{
_item = item;
}
IEnumerator IEnumerable.GetEnumerator()
{
return new Enumerator(_item);
}
void ICollection.CopyTo(Array array, int index)
{
array.SetValue(_item, index);
}
int IList.Add(object value)
{
throw new NotSupportedException();
}
void IList.Clear()
{
throw new NotSupportedException();
}
bool IList.Contains(object value)
{
return EqualityComparer<T>.Default.Equals(_item, (T)value);
}
int IList.IndexOf(object value)
{
if (!EqualityComparer<T>.Default.Equals(_item, (T)value))
{
return -1;
}
return 0;
}
void IList.Insert(int index, object value)
{
throw new NotSupportedException();
}
void IList.Remove(object value)
{
throw new NotSupportedException();
}
void IList.RemoveAt(int index)
{
throw new NotSupportedException();
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return new Enumerator(_item);
}
void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}
void ICollection<T>.Clear()
{
throw new NotSupportedException();
}
bool ICollection<T>.Contains(T item)
{
return EqualityComparer<T>.Default.Equals(_item, item);
}
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
{
array[arrayIndex] = _item;
}
bool ICollection<T>.Remove(T item)
{
throw new NotSupportedException();
}
int IList<T>.IndexOf(T item)
{
if (!EqualityComparer<T>.Default.Equals(_item, item))
{
return -1;
}
return 0;
}
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException();
}
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException();
}
}