Decompiled source of SimulacrumTweaks v1.0.2

SimulacrumTweaks.dll

Decompiled 7 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG.Reflection;
using IL.RoR2;
using InLobbyConfig;
using InLobbyConfig.Fields;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using R2API.Utils;
using RoR2;
using ShareSuite;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("SimulacrumTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SimulacrumTweaks")]
[assembly: AssemblyTitle("SimulacrumTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[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 SimulacrumTweaks
{
	public class BepConfig
	{
		public static ConfigEntry<bool> SimulacrumNonSharedLoot;

		public static ConfigEntry<int> SimulacrumLootMaxItemDebt;

		public static ConfigEntry<float> SimulacrumCommencementArtifactDissonanceChance;

		public static ConfigEntry<float> SimulacrumDirectorEnemyPowerBias;

		public static ConfigEntry<bool> Enabled { get; set; }

		public static void Init()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			ConfigFile config = ((BaseUnityPlugin)SimulacrumTweaks.instance).Config;
			Enabled = config.Bind<bool>("Main", "Enabled", true, "Enable Mod");
			SimulacrumNonSharedLoot = config.Bind<bool>("Simulacrum", "Non-shared loot", false, new ConfigDescription("(ShareSuite only) Forces the loot dropped at the end of each wave to be non-shared.", (AcceptableValueBase)null, Array.Empty<object>()));
			SimulacrumLootMaxItemDebt = config.Bind<int>("Simulacrum", "Max loot debt", 2, new ConfigDescription("Prevents greedy players from taking too much of the loot dropped at the end of each wave.", (AcceptableValueBase)null, Array.Empty<object>()));
			SimulacrumCommencementArtifactDissonanceChance = config.Bind<float>("Simulacrum", "Commencement Artifact of Dissonance Chance", 0.5f, new ConfigDescription("The chance for Artifact of Dissonance to be activated each wave when in the commencement stage to increase enemy variety.", (AcceptableValueBase)null, Array.Empty<object>()));
			SimulacrumDirectorEnemyPowerBias = config.Bind<float>("Simulacrum", "Director: Enemy Power Bias", 0.5f, new ConfigDescription("Bias towards many,weak enemies (=0) or few,strong enemies (=1). Value between 0 and 1, 0.5 = default.", (AcceptableValueBase)null, Array.Empty<object>()));
			if (ModCompatibilityInLobbyConfig.enabled)
			{
				ModCompatibilityInLobbyConfig.CreateFromBepInExConfigFile(config, "Simulacrum Tweaks");
			}
		}
	}
	public static class ChatHelper
	{
		private const string RedColor = "ff0000";

		private const string GreenColor = "32cd32";

		private const string SilverColor = "c0c0c0";

		public static void PlayerHasTooManyItems(string userName)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			string baseToken = "<color=#ff0000>" + userName + " is being greedy!</color>";
			Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
			{
				baseToken = baseToken
			});
		}
	}
	public class EnumCollection
	{
		public enum ArtifactEnum
		{
			None,
			Chaos,
			Command,
			Death,
			Dissonance,
			Enigma,
			Evolution,
			Frailty,
			Glass,
			Honor,
			Kin,
			Metamorphosis,
			Sacrifice,
			Soul,
			Spite,
			Swarms,
			Vengeance
		}

		public enum StageEnum
		{
			None,
			TitanicPlains,
			DistantRoost,
			WetlandAspect,
			AbandonedAqueduct,
			RallypointDelta,
			ScorchedAcres,
			AbyssalDepths,
			SirensCall,
			GildedCoast,
			MomentFractured,
			Bazaar,
			VoidFields,
			MomentWhole,
			SkyMeadow,
			BullwarksAmbry,
			Commencement,
			SunderedGrove,
			VoidLocus,
			Planetarium,
			AphelianSanctuary,
			SimulacrumAbandonedAquaduct,
			SimulacrumAbyssalDepths,
			SimulacrumAphelianSanctuary,
			SimulacrumCommencement,
			SimulacrumRallypointDelta,
			SimulacrumSkyMeadow,
			SimulacrumTitanicPlains,
			SiphonedForest,
			SulfurPools
		}

		public static Dictionary<StageEnum, List<string>> SceneNames = new Dictionary<StageEnum, List<string>>
		{
			{
				StageEnum.TitanicPlains,
				new List<string> { "golemplains", "golemplains2", "golemplains trailer" }
			},
			{
				StageEnum.DistantRoost,
				new List<string> { "blackbeach", "blackbeach2", "blackbeachTest" }
			},
			{
				StageEnum.WetlandAspect,
				new List<string> { "foggyswamp" }
			},
			{
				StageEnum.AbandonedAqueduct,
				new List<string> { "goolake" }
			},
			{
				StageEnum.RallypointDelta,
				new List<string> { "frozenwall" }
			},
			{
				StageEnum.ScorchedAcres,
				new List<string> { "wispgraveyard" }
			},
			{
				StageEnum.AbyssalDepths,
				new List<string> { "dampcavesimple" }
			},
			{
				StageEnum.SirensCall,
				new List<string> { "shipgraveyard" }
			},
			{
				StageEnum.GildedCoast,
				new List<string> { "goldshores" }
			},
			{
				StageEnum.MomentFractured,
				new List<string> { "mysteryspace" }
			},
			{
				StageEnum.Bazaar,
				new List<string> { "bazaar" }
			},
			{
				StageEnum.VoidFields,
				new List<string> { "arena" }
			},
			{
				StageEnum.MomentWhole,
				new List<string> { "limbo" }
			},
			{
				StageEnum.SkyMeadow,
				new List<string> { "skymeadow" }
			},
			{
				StageEnum.BullwarksAmbry,
				new List<string> { "artifactworld" }
			},
			{
				StageEnum.Commencement,
				new List<string> { "moon", "moon2" }
			},
			{
				StageEnum.SunderedGrove,
				new List<string> { "rootjungle" }
			},
			{
				StageEnum.VoidLocus,
				new List<string> { "voidstage" }
			},
			{
				StageEnum.Planetarium,
				new List<string> { "voidraid" }
			},
			{
				StageEnum.AphelianSanctuary,
				new List<string> { "ancientloft" }
			},
			{
				StageEnum.SimulacrumAbandonedAquaduct,
				new List<string> { "itgoolake" }
			},
			{
				StageEnum.SimulacrumAbyssalDepths,
				new List<string> { "itdampcave" }
			},
			{
				StageEnum.SimulacrumAphelianSanctuary,
				new List<string> { "itancientloft" }
			},
			{
				StageEnum.SimulacrumCommencement,
				new List<string> { "itmoon" }
			},
			{
				StageEnum.SimulacrumRallypointDelta,
				new List<string> { "itfrozenwall" }
			},
			{
				StageEnum.SimulacrumSkyMeadow,
				new List<string> { "itskymeadow" }
			},
			{
				StageEnum.SimulacrumTitanicPlains,
				new List<string> { "itgolemplains" }
			},
			{
				StageEnum.SiphonedForest,
				new List<string> { "snowyforest" }
			},
			{
				StageEnum.SulfurPools,
				new List<string> { "sulfurpools" }
			}
		};

		public static bool IsSimulacrumStage(string name)
		{
			if (GetStageName(StageEnum.SimulacrumAbandonedAquaduct) == name)
			{
				return true;
			}
			if (GetStageName(StageEnum.SimulacrumAbyssalDepths) == name)
			{
				return true;
			}
			if (GetStageName(StageEnum.SimulacrumAphelianSanctuary) == name)
			{
				return true;
			}
			if (GetStageName(StageEnum.SimulacrumCommencement) == name)
			{
				return true;
			}
			if (GetStageName(StageEnum.SimulacrumRallypointDelta) == name)
			{
				return true;
			}
			if (GetStageName(StageEnum.SimulacrumSkyMeadow) == name)
			{
				return true;
			}
			if (GetStageName(StageEnum.SimulacrumTitanicPlains) == name)
			{
				return true;
			}
			return false;
		}

		public static string GetStageName(StageEnum stageEnum)
		{
			return SceneNames[stageEnum].First();
		}

		public static ArtifactDef GetArtifactDef(ArtifactEnum artifacts)
		{
			return (ArtifactDef)(artifacts switch
			{
				ArtifactEnum.Chaos => Artifacts.FriendlyFire, 
				ArtifactEnum.Command => Artifacts.Command, 
				ArtifactEnum.Death => Artifacts.TeamDeath, 
				ArtifactEnum.Dissonance => Artifacts.MixEnemy, 
				ArtifactEnum.Enigma => Artifacts.Enigma, 
				ArtifactEnum.Evolution => Artifacts.MonsterTeamGainsItems, 
				ArtifactEnum.Frailty => Artifacts.WeakAssKnees, 
				ArtifactEnum.Glass => Artifacts.Glass, 
				ArtifactEnum.Honor => Artifacts.EliteOnly, 
				ArtifactEnum.Kin => Artifacts.SingleMonsterType, 
				ArtifactEnum.Metamorphosis => Artifacts.RandomSurvivorOnRespawn, 
				ArtifactEnum.Sacrifice => Artifacts.Sacrifice, 
				ArtifactEnum.Soul => Artifacts.WispOnDeath, 
				ArtifactEnum.Spite => Artifacts.Bomb, 
				ArtifactEnum.Swarms => Artifacts.Swarms, 
				ArtifactEnum.Vengeance => Artifacts.ShadowClone, 
				_ => null, 
			});
		}
	}
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void LogDebug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void LogError(object data)
		{
			_logSource.LogError(data);
		}

		internal static void LogFatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void LogInfo(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void LogMessage(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void LogWarning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	public static class ModCompatibilityInLobbyConfig
	{
		private static bool? _enabled;

		public static bool enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.InLobbyConfig");
				}
				return _enabled.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void CreateFromBepInExConfigFile(ConfigFile config, string displayName)
		{
			ModConfigCatalog.Add(ConfigFieldUtilities.CreateFromBepInExConfigFile(config, displayName));
		}
	}
	public static class ModCompatibilityShareSuite
	{
		private static bool? _enabled;

		public static bool enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = Chainloader.PluginInfos.ContainsKey("com.funkfrog_sipondo.sharesuite");
				}
				return _enabled.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AddPickupEventHandler(Func<GenericPickupController, CharacterBody, bool> f)
		{
			ItemSharingHooks.AdditionalPickupValidityChecks += f;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void RemovePickupEventHandler(Func<GenericPickupController, CharacterBody, bool> f)
		{
			ItemSharingHooks.AdditionalPickupValidityChecks -= f;
		}
	}
	public class NonShareableItem : MonoBehaviour
	{
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Def.SimulacrumTweaks", "SimulacrumTweaks", "1.0.1")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class SimulacrumTweaks : BaseUnityPlugin
	{
		public static SimulacrumTweaks instance;

		public static int totalItemRewardCount = 0;

		public static GameObject mostRecentlyCreatedPickup = null;

		public static Dictionary<NetworkUserId, float> usersItemCredit = new Dictionary<NetworkUserId, float>();

		public const string PluginGUID = "Def.SimulacrumTweaks";

		public const string PluginAuthor = "Def";

		public const string PluginName = "SimulacrumTweaks";

		public const string PluginVersion = "1.0.1";

		public static PluginInfo PInfo { get; private set; }

		public void Awake()
		{
			PInfo = ((BaseUnityPlugin)this).Info;
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			BepConfig.Init();
		}

		private void OnEnable()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			InfiniteTowerRun.Start += new hook_Start(InfiniteTowerRun_Start);
			InfiniteTowerRun.OnWaveAllEnemiesDefeatedServer += new hook_OnWaveAllEnemiesDefeatedServer(InfiniteTowerRun_OnWaveAllEnemiesDefeatedServer);
			InfiniteTowerRun.AdvanceWave += new hook_AdvanceWave(InfiniteTowerRun_AdvanceWave);
			CombatDirector.AttemptSpawnOnTarget += new Manipulator(CombatDirector_AttemptSpawnOnTarget);
			InfiniteTowerRun.FixedUpdate += new hook_FixedUpdate(InfiniteTowerRun_FixedUpdate);
			InfiniteTowerWaveController.DropRewards += new Manipulator(InfiniteTowerWaveController_DropRewards);
			InfiniteTowerWaveController.DropRewards += new hook_DropRewards(InfiniteTowerWaveController_DropRewards1);
			GenericPickupController.AttemptGrant += new hook_AttemptGrant(GenericPickupController_AttemptGrant);
			GenericPickupController.OnInteractionBegin += new hook_OnInteractionBegin(GenericPickupController_OnInteractionBegin);
			GenericPickupController.CreatePickup += new Manipulator(GenericPickupController_CreatePickup);
			PickupDropletController.OnCollisionEnter += new hook_OnCollisionEnter(PickupDropletController_OnCollisionEnter);
			PickupPickerController.OnInteractionBegin += new hook_OnInteractionBegin(PickupPickerController_OnInteractionBegin);
			PickupPickerController.CreatePickup_PickupIndex += new hook_CreatePickup_PickupIndex(PickupPickerController_CreatePickup_PickupIndex);
			if (ModCompatibilityShareSuite.enabled)
			{
				ModCompatibilityShareSuite.AddPickupEventHandler(NonShareableItemCheck);
			}
		}

		private void OnDisable()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			InfiniteTowerRun.Start -= new hook_Start(InfiniteTowerRun_Start);
			InfiniteTowerRun.OnWaveAllEnemiesDefeatedServer -= new hook_OnWaveAllEnemiesDefeatedServer(InfiniteTowerRun_OnWaveAllEnemiesDefeatedServer);
			InfiniteTowerRun.AdvanceWave -= new hook_AdvanceWave(InfiniteTowerRun_AdvanceWave);
			CombatDirector.AttemptSpawnOnTarget -= new Manipulator(CombatDirector_AttemptSpawnOnTarget);
			InfiniteTowerRun.FixedUpdate -= new hook_FixedUpdate(InfiniteTowerRun_FixedUpdate);
			InfiniteTowerWaveController.DropRewards -= new Manipulator(InfiniteTowerWaveController_DropRewards);
			InfiniteTowerWaveController.DropRewards -= new hook_DropRewards(InfiniteTowerWaveController_DropRewards1);
			GenericPickupController.AttemptGrant -= new hook_AttemptGrant(GenericPickupController_AttemptGrant);
			GenericPickupController.OnInteractionBegin -= new hook_OnInteractionBegin(GenericPickupController_OnInteractionBegin);
			GenericPickupController.CreatePickup -= new Manipulator(GenericPickupController_CreatePickup);
			PickupDropletController.OnCollisionEnter -= new hook_OnCollisionEnter(PickupDropletController_OnCollisionEnter);
			PickupPickerController.OnInteractionBegin -= new hook_OnInteractionBegin(PickupPickerController_OnInteractionBegin);
			PickupPickerController.CreatePickup_PickupIndex -= new hook_CreatePickup_PickupIndex(PickupPickerController_CreatePickup_PickupIndex);
			if (ModCompatibilityShareSuite.enabled)
			{
				ModCompatibilityShareSuite.RemovePickupEventHandler(NonShareableItemCheck);
			}
		}

		private bool NonShareableItemCheck(GenericPickupController pickup, CharacterBody picker)
		{
			NonShareableItem nonShareableItem = default(NonShareableItem);
			if (BepConfig.SimulacrumNonSharedLoot.Value)
			{
				return !((Component)pickup).TryGetComponent<NonShareableItem>(ref nonShareableItem);
			}
			return true;
		}

		private void InfiniteTowerRun_Start(orig_Start orig, InfiniteTowerRun self)
		{
			totalItemRewardCount = 0;
			mostRecentlyCreatedPickup = null;
			usersItemCredit.Clear();
			orig.Invoke(self);
		}

		private void InfiniteTowerRun_FixedUpdate(orig_FixedUpdate orig, InfiniteTowerRun self)
		{
			orig.Invoke(self);
			_ = NetworkServer.active;
		}

		private void PickupPickerController_OnInteractionBegin(orig_OnInteractionBegin orig, PickupPickerController self, Interactor activator)
		{
			if (CanInteract(((Component)self).gameObject, activator))
			{
				orig.Invoke(self, activator);
			}
		}

		private void GenericPickupController_OnInteractionBegin(orig_OnInteractionBegin orig, GenericPickupController self, Interactor activator)
		{
			if (CanInteract(((Component)self).gameObject, activator))
			{
				orig.Invoke(self, activator);
			}
		}

		private bool CanInteract(GameObject self, Interactor activator)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (!BepConfig.Enabled.Value)
			{
				return true;
			}
			NonShareableItem nonShareableItem = default(NonShareableItem);
			if (self.TryGetComponent<NonShareableItem>(ref nonShareableItem))
			{
				NetworkUser val = Util.LookUpBodyNetworkUser((activator != null) ? ((Component)activator).GetComponent<CharacterBody>() : null);
				if ((Object)(object)val != (Object)null)
				{
					usersItemCredit.TryGetValue(val.id, out var value);
					if (value >= (float)(-BepConfig.SimulacrumLootMaxItemDebt.Value))
					{
						return true;
					}
					ChatHelper.PlayerHasTooManyItems(val.userName);
					return false;
				}
			}
			return true;
		}

		private void GenericPickupController_AttemptGrant(orig_AttemptGrant orig, GenericPickupController self, CharacterBody body)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, body);
			NonShareableItem nonShareableItem = default(NonShareableItem);
			if (NetworkServer.active && BepConfig.Enabled.Value && ((Component)self).TryGetComponent<NonShareableItem>(ref nonShareableItem) && self.consumed)
			{
				NetworkUser val = Util.LookUpBodyNetworkUser(body);
				if (usersItemCredit.ContainsKey(val.id))
				{
					usersItemCredit[val.id] -= 1f;
				}
				else
				{
					usersItemCredit.Add(val.id, -1f);
				}
			}
		}

		private void InfiniteTowerWaveController_DropRewards(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			val.DefineLabel();
			val.GotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 6),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 4),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 2),
				(Instruction x) => ILPatternMatchingExt.MatchCall<PickupDropletController>(x, "CreatePickupDroplet")
			});
			val.Index += 3;
			val.Remove();
			val.EmitDelegate<Action<CreatePickupInfo, Vector3, Vector3>>((Action<CreatePickupInfo, Vector3, Vector3>)delegate(CreatePickupInfo pickupInfo, Vector3 position, Vector3 velocity)
			{
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: 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)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				if (BepConfig.Enabled.Value)
				{
					GameObject obj = Object.Instantiate<GameObject>(PickupDropletController.pickupDropletPrefab, position, Quaternion.identity);
					PickupDropletController component = obj.GetComponent<PickupDropletController>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.createPickupInfo = pickupInfo;
						component.NetworkpickupIndex = ((CreatePickupInfo)(ref pickupInfo)).pickupIndex;
					}
					Rigidbody component2 = obj.GetComponent<Rigidbody>();
					component2.velocity = velocity;
					component2.AddTorque(Random.Range(150f, 120f) * Random.onUnitSphere);
					obj.AddComponent<NonShareableItem>();
					NetworkServer.Spawn(obj);
					totalItemRewardCount++;
				}
				else
				{
					PickupDropletController.CreatePickupDroplet(pickupInfo, position, velocity);
				}
			});
		}

		private void InfiniteTowerWaveController_DropRewards1(orig_DropRewards orig, InfiniteTowerWaveController self)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!NetworkServer.active || !BepConfig.Enabled.Value)
			{
				return;
			}
			int num = PlayerCharacterMasterController.instances.Where((PlayerCharacterMasterController pc) => pc.isConnected).Count();
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (instance.isConnected)
				{
					float value = 0f;
					usersItemCredit.TryGetValue(instance.networkUser.id, out value);
					if (usersItemCredit.ContainsKey(instance.networkUser.id))
					{
						usersItemCredit[instance.networkUser.id] += (float)totalItemRewardCount / (float)num;
					}
					else
					{
						usersItemCredit.Add(instance.networkUser.id, (float)totalItemRewardCount / (float)num);
					}
					Log.LogDebug(instance.networkUser.userName + " itemCredit: " + usersItemCredit[instance.networkUser.id]);
				}
			}
			totalItemRewardCount = 0;
		}

		private void PickupDropletController_OnCollisionEnter(orig_OnCollisionEnter orig, PickupDropletController self, Collision collision)
		{
			mostRecentlyCreatedPickup = null;
			orig.Invoke(self, collision);
			if (BepConfig.Enabled.Value && (Object)(object)mostRecentlyCreatedPickup != (Object)null && Object.op_Implicit((Object)(object)((Component)self).GetComponent<NonShareableItem>()))
			{
				mostRecentlyCreatedPickup.AddComponent<NonShareableItem>();
			}
		}

		private void PickupPickerController_CreatePickup_PickupIndex(orig_CreatePickup_PickupIndex orig, PickupPickerController self, PickupIndex pickupIndex)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			mostRecentlyCreatedPickup = null;
			orig.Invoke(self, pickupIndex);
			if (BepConfig.Enabled.Value && (Object)(object)mostRecentlyCreatedPickup != (Object)null && Object.op_Implicit((Object)(object)((Component)self).GetComponent<NonShareableItem>()))
			{
				mostRecentlyCreatedPickup.AddComponent<NonShareableItem>();
			}
		}

		private void GenericPickupController_CreatePickup(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			val.DefineLabel();
			val.GotoNext(new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CreatePickupInfo>(x, "position"),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CreatePickupInfo>(x, "rotation"),
				(Instruction x) => ILPatternMatchingExt.MatchCall<Object>(x, "Instantiate"),
				(Instruction x) => ILPatternMatchingExt.MatchDup(x)
			});
			val.Index += 5;
			val.EmitDelegate<Func<GameObject, GameObject>>((Func<GameObject, GameObject>)delegate(GameObject obj)
			{
				mostRecentlyCreatedPickup = obj;
				return obj;
			});
			Log.LogDebug(il);
		}

		private void CombatDirector_AttemptSpawnOnTarget(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel val2 = val.DefineLabel();
			val.GotoNext(new Func<Instruction, bool>[7]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CombatDirector>(x, "maximumNumberToSpawnBeforeSkipping"),
				(Instruction x) => ILPatternMatchingExt.MatchMul(x),
				(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CombatDirector>(x, "monsterCredit")
			});
			val.Index += 6;
			val.Remove();
			val.Remove();
			val.EmitDelegate<Func<float, CombatDirector, bool>>((Func<float, CombatDirector, bool>)delegate(float costMultipliedByMaximumNumberToSpawnBeforeSkipping, CombatDirector combatDirector)
			{
				if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun) && BepConfig.Enabled.Value)
				{
					if (costMultipliedByMaximumNumberToSpawnBeforeSkipping / (float)combatDirector.maximumNumberToSpawnBeforeSkipping > (float)combatDirector.mostExpensiveMonsterCostInDeck * (0.5f + BepConfig.SimulacrumDirectorEnemyPowerBias.Value) * (0.5f + BepConfig.SimulacrumDirectorEnemyPowerBias.Value) * (0.5f + BepConfig.SimulacrumDirectorEnemyPowerBias.Value))
					{
						float num = Math.Max(0f, 0.1f - BepConfig.SimulacrumDirectorEnemyPowerBias.Value);
						if (2f * (0.5f - BepConfig.SimulacrumDirectorEnemyPowerBias.Value) - num > RoR2Application.rng.nextNormalizedFloat)
						{
							return true;
						}
					}
					return costMultipliedByMaximumNumberToSpawnBeforeSkipping * (1.5f - BepConfig.SimulacrumDirectorEnemyPowerBias.Value) * (1.5f - BepConfig.SimulacrumDirectorEnemyPowerBias.Value) < combatDirector.monsterCredit;
				}
				return costMultipliedByMaximumNumberToSpawnBeforeSkipping < combatDirector.monsterCredit;
			});
			val.Emit(OpCodes.Brfalse, (object)val2);
			val.GotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CombatDirector>(x, "currentMonsterCard"),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<DirectorCard>(x, "spawnCard"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 4)
			});
			val.MarkLabel(val2);
		}

		private void InfiniteTowerRun_OnWaveAllEnemiesDefeatedServer(orig_OnWaveAllEnemiesDefeatedServer orig, InfiniteTowerRun self, InfiniteTowerWaveController wc)
		{
			orig.Invoke(self, wc);
			if (BepConfig.Enabled.Value && NetworkServer.active && !(BepConfig.SimulacrumCommencementArtifactDissonanceChance.Value <= 0f) && (SceneCatalog.currentSceneDef.cachedName == EnumCollection.GetStageName(EnumCollection.StageEnum.SimulacrumCommencement) || SceneCatalog.currentSceneDef.cachedName == EnumCollection.GetStageName(EnumCollection.StageEnum.Commencement)))
			{
				RunArtifactManager.instance.SetArtifactEnabledServer(EnumCollection.GetArtifactDef(EnumCollection.ArtifactEnum.Dissonance), false);
			}
		}

		private void InfiniteTowerRun_AdvanceWave(orig_AdvanceWave orig, InfiniteTowerRun self)
		{
			orig.Invoke(self);
			if (BepConfig.Enabled.Value && NetworkServer.active && !(BepConfig.SimulacrumCommencementArtifactDissonanceChance.Value <= 0f) && (SceneCatalog.currentSceneDef.cachedName == EnumCollection.GetStageName(EnumCollection.StageEnum.SimulacrumCommencement) || SceneCatalog.currentSceneDef.cachedName == EnumCollection.GetStageName(EnumCollection.StageEnum.Commencement)) && BepConfig.SimulacrumCommencementArtifactDissonanceChance.Value > RoR2Application.rng.nextNormalizedFloat)
			{
				RunArtifactManager.instance.SetArtifactEnabledServer(EnumCollection.GetArtifactDef(EnumCollection.ArtifactEnum.Dissonance), true);
			}
		}
	}
}