Decompiled source of mithrixslop v1.0.2

MithrixSlop.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG.Reflection;
using IL.RoR2;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Projectile;
using RoR2.UI;
using RoR2BepInExPack.GameAssetPathsBetter;
using TMPro;
using ThunderstoreInterface;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MithrixSlop")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8bd81e615972b6895b32100e0c46f872556df388")]
[assembly: AssemblyProduct("MithrixSlop")]
[assembly: AssemblyTitle("MithrixSlop")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 MithrixSlop
{
	public class LockTeleporterUntilPillarCompletion : MonoBehaviour
	{
		private class PrimalBirthrightObjectiveTracker : ObjectiveTracker
		{
			public override string GenerateString()
			{
				if (instance.pillars.Count != 0)
				{
					return "Complete the <style=cIsLunar>Pillar(s)</style>!";
				}
				return "Completed the <style=cIsLunar>Pillar(s)</style>!";
			}

			public override bool IsDirty()
			{
				return true;
			}
		}

		public static LockTeleporterUntilPillarCompletion instance;

		private List<HoldoutZoneController> pillars = new List<HoldoutZoneController>();

		private GameObject lockObject;

		private HoldoutZoneController teleHoldout;

		private Material prevTeleMat;

		private GameObject loopHolder;

		private Color prevChargeColor;

		private static Material teleMat;

		private static readonly int RemapTex = Shader.PropertyToID("_RemapTex");

		private float stuckChargePercent = -1f;

		private void OnEnable()
		{
			instance = this;
			teleHoldout = ((Component)this).gameObject.GetComponent<HoldoutZoneController>();
		}

		private void OnPillarsChanged()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Invalid comparison between Unknown and I4
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Invalid comparison between Unknown and I4
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			if (pillars.Count == 0)
			{
				TeleporterInteraction.instance.locked = false;
				if (Object.op_Implicit((Object)(object)lockObject))
				{
					NetworkServer.Destroy(lockObject);
				}
				ObjectivePanelController.collectObjectiveSources -= OnCollectObjectiveSources;
				if ((int)TeleporterInteraction.instance.activationState == 2)
				{
					((Renderer)((Component)teleHoldout.radiusIndicator).gameObject.GetComponent<MeshRenderer>()).material = prevTeleMat;
					TeleporterInteraction.instance.teleporterChargeIndicatorController.spriteChargingColor = prevChargeColor;
					stuckChargePercent = -1f;
					if (Object.op_Implicit((Object)(object)loopHolder))
					{
						loopHolder.SetActive(true);
					}
				}
			}
			else
			{
				if (!(stuckChargePercent < 0f))
				{
					return;
				}
				TeleporterInteraction.instance.locked = true;
				if (!Object.op_Implicit((Object)(object)lockObject))
				{
					lockObject = Object.Instantiate<GameObject>(MithrixSlop.purchaseLockBlue, ((Component)TeleporterInteraction.instance).gameObject.transform);
					NetworkServer.Spawn(lockObject);
				}
				ObjectivePanelController.collectObjectiveSources += OnCollectObjectiveSources;
				if ((int)TeleporterInteraction.instance.activationState == 2)
				{
					MeshRenderer component = ((Component)teleHoldout.radiusIndicator).gameObject.GetComponent<MeshRenderer>();
					if (!Object.op_Implicit((Object)(object)teleMat))
					{
						prevTeleMat = ((Renderer)component).material;
						teleMat = Object.Instantiate<Material>(prevTeleMat);
						teleMat.SetTexture(RemapTex, (Texture)(object)Addressables.LoadAssetAsync<Texture2D>((object)RoR2_Base_Common_ColorRamps.texRampLunarWispFire_png).WaitForCompletion());
					}
					((Renderer)component).material = teleMat;
					stuckChargePercent = teleHoldout.charge;
					prevChargeColor = TeleporterInteraction.instance.teleporterChargeIndicatorController.spriteChargingColor;
					TeleporterInteraction.instance.teleporterChargeIndicatorController.spriteChargingColor = Color32.op_Implicit(new Color32((byte)172, (byte)244, (byte)252, byte.MaxValue));
					Transform obj = ((Component)TeleporterInteraction.instance).gameObject.transform.Find("TeleporterBaseMesh/BuiltInEffects/ChargingEffect/BetweenProngs/Loop");
					loopHolder = ((obj != null) ? ((Component)obj).gameObject : null);
					if (Object.op_Implicit((Object)(object)loopHolder))
					{
						loopHolder.SetActive(false);
					}
				}
			}
		}

		public void Update()
		{
			if (stuckChargePercent > 0f)
			{
				teleHoldout.charge = stuckChargePercent;
			}
		}

		public void OnDestroy()
		{
			ObjectivePanelController.collectObjectiveSources -= OnCollectObjectiveSources;
		}

		public void AddHoldout(HoldoutZoneController holdout)
		{
			((UnityEvent<HoldoutZoneController>)(object)holdout.onCharged).AddListener((UnityAction<HoldoutZoneController>)OnCharged);
			pillars.Add(holdout);
			OnPillarsChanged();
		}

		private void OnCharged(HoldoutZoneController holdout)
		{
			pillars.Remove(holdout);
			OnPillarsChanged();
		}

		private static void OnCollectObjectiveSources(CharacterMaster master, List<ObjectiveSourceDescriptor> objectiveSourcesList)
		{
			//IL_0002: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			ObjectiveSourceDescriptor item = new ObjectiveSourceDescriptor
			{
				master = master,
				objectiveType = typeof(PrimalBirthrightObjectiveTracker),
				source = (Object)(object)instance
			};
			objectiveSourcesList.Add(item);
		}
	}
	public class MassPillar : MonoBehaviour
	{
		private void Start()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((Component)this).GetComponent<OnDisableEvent>().action.AddListener(new UnityAction(SpawnPillar));
		}

		private void SpawnPillar()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Expected O, but got Unknown
			if (!NetworkServer.active)
			{
				return;
			}
			EffectData val = new EffectData
			{
				origin = ((Component)this).transform.position
			};
			EffectManager.SpawnEffect(MithrixSlop.impactEffectPrefab, val, true);
			uint num = 35 + 7 * TeamManager.instance.GetTeamLevel((TeamIndex)2);
			BlastAttack val2 = new BlastAttack
			{
				inflictor = ((Component)this).gameObject,
				baseDamage = num,
				baseForce = 400f,
				attackerFiltering = (AttackerFiltering)0,
				crit = false,
				falloffModel = (FalloffModel)1
			};
			CharacterBody braindeadmithrix5000unitsunderthemap = MithrixSlop.braindeadmithrix5000unitsunderthemap;
			val2.attacker = ((braindeadmithrix5000unitsunderthemap != null) ? ((Component)braindeadmithrix5000unitsunderthemap).gameObject : null);
			val2.bonusForce = Vector3.zero;
			val2.damageColorIndex = (DamageColorIndex)0;
			val2.position = ((Component)this).transform.position;
			val2.procChainMask = default(ProcChainMask);
			val2.procCoefficient = 1f;
			val2.teamIndex = (TeamIndex)2;
			val2.radius = 40f;
			val2.Fire();
			NetworkServer.Spawn(Object.Instantiate<GameObject>(MithrixSlop.massPilarModified, ((Component)this).transform.position, Quaternion.identity));
			List<PlayerCharacterMasterController> list = new List<PlayerCharacterMasterController>();
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (Object.op_Implicit((Object)(object)instance.body))
				{
					list.Add(instance);
				}
			}
			BrotherUltPattern pizzaFissure = MithrixSlop.pizzaFissure;
			BrotherUltContext val3 = new BrotherUltContext();
			CharacterBody braindeadmithrix5000unitsunderthemap2 = MithrixSlop.braindeadmithrix5000unitsunderthemap;
			val3.owner = ((braindeadmithrix5000unitsunderthemap2 != null) ? ((Component)braindeadmithrix5000unitsunderthemap2).gameObject : null);
			val3.target = ((Component)list[Random.Range(0, list.Count)].body).gameObject;
			val3.originOverride = ((Component)this).transform.position;
			val3.useOriginOverride = true;
			BrotherUltUtils.EvaluatePattern(pizzaFissure, val3);
		}
	}
	public class PillarLockCommunicator : MonoBehaviour
	{
		private HoldoutZoneController holdoutZoneController;

		private void OnEnable()
		{
			holdoutZoneController = ((Component)this).gameObject.GetComponent<HoldoutZoneController>();
			holdoutZoneController.baseChargeDuration = 30f;
			LockTeleporterUntilPillarCompletion lockTeleporterUntilPillarCompletion = default(LockTeleporterUntilPillarCompletion);
			if (!((Component)TeleporterInteraction.instance).gameObject.TryGetComponent<LockTeleporterUntilPillarCompletion>(ref lockTeleporterUntilPillarCompletion))
			{
				lockTeleporterUntilPillarCompletion = ((Component)TeleporterInteraction.instance).gameObject.AddComponent<LockTeleporterUntilPillarCompletion>();
			}
			lockTeleporterUntilPillarCompletion.AddHoldout(holdoutZoneController);
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

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

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

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

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

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

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

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInPlugin("kina.MithrixSlop", "MithrixSlop", "1.0.2")]
	public class MithrixSlop : BaseUnityPlugin
	{
		private const string PluginGUID = "kina.MithrixSlop";

		private const string PluginAuthor = "kina";

		private const string PluginName = "MithrixSlop";

		private const string PluginVersion = "1.0.2";

		private static ConfigEntry<int> karmaMultiplier;

		private static ConfigEntry<bool> karmaMultiplierUseAICount;

		private static ConfigEntry<bool> useWithoutAI;

		public static GameObject massProjectilePrefab;

		public static GameObject massPilarModified;

		public static GameObject purchaseLockBlue;

		public static GameObject ppEffect;

		public static PostProcessProfile ppp;

		public static BrotherUltPattern pizzaFissure;

		private List<BrotherUltPattern> pizzaPatterns = new List<BrotherUltPattern>();

		public static CharacterBody braindeadmithrix5000unitsunderthemap;

		private CharacterSpawnCard golemSpawnCard;

		private CharacterSpawnCard wispSpawnCard;

		public static GameObject impactEffectPrefab;

		private static readonly int MainTex = Shader.PropertyToID("_MainTex");

		private static readonly int TintColor = Shader.PropertyToID("_TintColor");

		private static readonly int RemapTex = Shader.PropertyToID("_RemapTex");

		public void Awake()
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Expected O, but got Unknown
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			Log.Init(((BaseUnityPlugin)this).Logger);
			karmaMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("MithrixSlop", "karma multiplier .,.,", 1, "if aigen mods are installed ,.. ,amount to multiply karma increases by ,.,., wont go under 2 if they are .,.,.");
			karmaMultiplier.SettingChanged += KarmaMultiplierOnSettingChanged;
			KarmaMultiplierOnSettingChanged(null, null);
			karmaMultiplierUseAICount = ((BaseUnityPlugin)this).Config.Bind<bool>("MithrixSlop", "increase karma by count of aigen mods  .,.,", false, "if aigen mods are installed ,.. ,karma count doesnt use multiplier and instead uses amount of aigen mods you have installed ,.,.,");
			useWithoutAI = ((BaseUnityPlugin)this).Config.Bind<bool>("MithrixSlop", "use karma additions without ai .,.,", true, "applies karma additions without needing ai mods installed ,... will also not change lang stuff ,.,.,");
			AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VendingMachine/VendingMachineProjectile.prefab");
			val.Completed += delegate(AsyncOperationHandle<GameObject> handle)
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				massProjectilePrefab = PrefabAPI.InstantiateClone(handle.Result, "MassProjectilePrefab", true);
				massProjectilePrefab.GetComponent<TeamFilter>().defaultTeam = (TeamIndex)3;
				Object.Destroy((Object)(object)massProjectilePrefab.GetComponent<OnDisableEvent>());
				Object.Destroy((Object)(object)massProjectilePrefab.GetComponent<ProjectileInstantiateDeployable>());
				massProjectilePrefab.AddComponent<OnDisableEvent>();
				massProjectilePrefab.AddComponent<MassPillar>();
				massProjectilePrefab.GetComponent<ProjectileImpactExplosion>().lifetime = 1f;
				ContentAddition.AddProjectile(massProjectilePrefab);
			};
			val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_moon2.MoonBatteryMass_prefab);
			val.Completed += delegate(AsyncOperationHandle<GameObject> handle)
			{
				massPilarModified = PrefabAPI.InstantiateClone(handle.Result, "MassPillarLockTele", true);
				massPilarModified.AddComponent<PillarLockCommunicator>();
			};
			val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Teleporters.PurchaseLock_prefab);
			val.Completed += delegate(AsyncOperationHandle<GameObject> handle)
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				purchaseLockBlue = PrefabAPI.InstantiateClone(handle.Result, "purchaseLockBlue", true);
				MainModule main = purchaseLockBlue.GetComponent<ParticleSystem>().main;
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(Color32.op_Implicit(new Color32((byte)3, (byte)220, (byte)245, byte.MaxValue)));
				Material val5 = null;
				Transform val6 = purchaseLockBlue.transform.Find("Prongs");
				for (int i = 0; i < val6.childCount; i++)
				{
					MeshRenderer component = ((Component)val6.GetChild(i)).gameObject.GetComponent<MeshRenderer>();
					if (!Object.op_Implicit((Object)(object)val5))
					{
						val5 = Object.Instantiate<Material>(((Renderer)component).material);
						val5.SetTexture(RemapTex, (Texture)(object)Addressables.LoadAssetAsync<Texture2D>((object)RoR2_Base_Common_ColorRamps.texRampIce_png).WaitForCompletion());
						val5.SetColor(TintColor, Color32.op_Implicit(new Color32((byte)0, (byte)109, (byte)148, byte.MaxValue)));
					}
					((Renderer)component).material = val5;
				}
			};
			AsyncOperationHandle<CharacterSpawnCard> val2 = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/LunarGolem/cscLunarGolem.asset");
			val2.Completed += delegate(AsyncOperationHandle<CharacterSpawnCard> handle)
			{
				golemSpawnCard = handle.Result;
			};
			val2 = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/LunarWisp/cscLunarWisp.asset");
			val2.Completed += delegate(AsyncOperationHandle<CharacterSpawnCard> handle)
			{
				wispSpawnCard = handle.Result;
			};
			val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Meteor/MeteorStrikeImpact.prefab");
			val.Completed += delegate(AsyncOperationHandle<GameObject> handle)
			{
				impactEffectPrefab = handle.Result;
			};
			AsyncOperationHandle<BrotherUltPattern> val3 = Addressables.LoadAssetAsync<BrotherUltPattern>((object)RoR2_Base_Brother.Ult_plusSign_asset);
			val3.Completed += delegate(AsyncOperationHandle<BrotherUltPattern> handle)
			{
				pizzaPatterns.Add(handle.Result);
				pizzaFissure = handle.Result;
			};
			val3 = Addressables.LoadAssetAsync<BrotherUltPattern>((object)RoR2_Base_Brother.Ult_clock_asset);
			val3.Completed += delegate(AsyncOperationHandle<BrotherUltPattern> handle)
			{
				pizzaPatterns.Add(handle.Result);
			};
			val3 = Addressables.LoadAssetAsync<BrotherUltPattern>((object)RoR2_Base_Brother.Ult_scissor_asset);
			val3.Completed += delegate(AsyncOperationHandle<BrotherUltPattern> handle)
			{
				pizzaPatterns.Add(handle.Result);
			};
			val3 = Addressables.LoadAssetAsync<BrotherUltPattern>((object)RoR2_Base_Brother.Ult_passiveAttack_asset);
			val3.Completed += delegate(AsyncOperationHandle<BrotherUltPattern> handle)
			{
				pizzaPatterns.Add(handle.Result);
			};
			val3 = Addressables.LoadAssetAsync<BrotherUltPattern>((object)RoR2_Base_Brother.Ult_singleBlast_asset);
			val3.Completed += delegate(AsyncOperationHandle<BrotherUltPattern> handle)
			{
				pizzaPatterns.Add(handle.Result);
			};
			val3 = Addressables.LoadAssetAsync<BrotherUltPattern>((object)RoR2_Base_Brother.Ult_defaultRotatingLeft_asset);
			val3.Completed += delegate(AsyncOperationHandle<BrotherUltPattern> handle)
			{
				pizzaPatterns.Add(handle.Result);
			};
			val3 = Addressables.LoadAssetAsync<BrotherUltPattern>((object)RoR2_Base_Brother.Ult_defaultRotatingRight_asset);
			val3.Completed += delegate(AsyncOperationHandle<BrotherUltPattern> handle)
			{
				pizzaPatterns.Add(handle.Result);
			};
			ppEffect = PrefabAPI.CreateEmptyPrefab("karmaBlue", true);
			PostProcessVolume val4 = ppEffect.AddComponent<PostProcessVolume>();
			val4.priority = 2.2f;
			val4.isGlobal = true;
			PostProcessDuration obj = ppEffect.AddComponent<PostProcessDuration>();
			obj.ppVolume = val4;
			obj.destroyOnEnd = true;
			obj.maxDuration = 2f;
			obj.ppWeightCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(0f, 1f),
				new Keyframe(1f, 0f)
			});
			ppEffect.layer = (int)(ref LayerIndex.postProcess);
			ppp = ScriptableObject.CreateInstance<PostProcessProfile>();
			ColorGrading obj2 = ppp.AddSettings<ColorGrading>();
			((ParameterOverride<float>)(object)obj2.postExposure).value = 0.1f;
			((ParameterOverride)obj2.postExposure).overrideState = true;
			((ParameterOverride<float>)(object)obj2.contrast).value = 40f;
			((ParameterOverride)obj2.contrast).overrideState = true;
			((ParameterOverride<Vector4>)(object)obj2.gain).value = new Vector4(0.83f, 1.01f, 1.35f);
			((ParameterOverride)obj2.gain).overrideState = true;
			((ParameterOverride<bool>)(object)((PostProcessEffectSettings)obj2).enabled).value = true;
			((PostProcessEffectSettings)obj2).active = true;
			Vignette obj3 = ppp.AddSettings<Vignette>();
			((ParameterOverride<VignetteMode>)(object)obj3.mode).value = (VignetteMode)0;
			((ParameterOverride)obj3.mode).overrideState = true;
			((ParameterOverride<float>)(object)obj3.intensity).value = 0.2f;
			((ParameterOverride)obj3.intensity).overrideState = true;
			((ParameterOverride<Color>)(object)obj3.color).value = Color32.op_Implicit(new Color32((byte)44, (byte)62, (byte)144, byte.MaxValue));
			((ParameterOverride)obj3.color).overrideState = true;
			((ParameterOverride<bool>)(object)((PostProcessEffectSettings)obj3).enabled).value = true;
			((PostProcessEffectSettings)obj3).active = true;
			((Object)ppp).name = "KarmaBlueProfile";
			val4.sharedProfile = ppp;
			if (useWithoutAI.Value)
			{
				Hook();
			}
			ThunderstoreInterface.containsAI = (Action)Delegate.Combine(ThunderstoreInterface.containsAI, (Action)delegate
			{
				Log.Fatal("yuck ,.,,.");
				if (!useWithoutAI.Value)
				{
					Hook();
				}
				KarmaMultiplierOnSettingChanged(null, null);
				LanguageAPI.Add("NOTIFICATION_KARMA_INCREASED", "The Moon is disgusted by your slop.");
				LanguageAPI.Add("NOTIFICATION_KARMA_INCREASED_MAXKARMA", "The Moon doesn't want to be tarnished by your slop.");
			});
			static void KarmaMultiplierOnSettingChanged(object sender, EventArgs e)
			{
				if (karmaMultiplier.Value < 0)
				{
					karmaMultiplier.Value = 1;
				}
				if (ThunderstoreInterface.aigenMods.Count > 0 && karmaMultiplier.Value <= 1)
				{
					karmaMultiplier.Value = 2;
				}
			}
		}

		private void Hook()
		{
			//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_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
			KarmaManager.GetEffectiveKarmaMultiplier += new hook_GetEffectiveKarmaMultiplier(KarmaManagerOnGetEffectiveKarmaMultiplier);
			KarmaIcon.OnKarmaChanged += new hook_OnKarmaChanged(KarmaIconOnOnKarmaChanged);
			TeleporterInteraction.OnBossDirectorSpawnedMonsterServer += new hook_OnBossDirectorSpawnedMonsterServer(TeleporterInteractionOnOnBossDirectorSpawnedMonsterServer);
			KarmaManager.onKarmaChangedServer += KarmaManagerOnonKarmaChangedServer;
			GlobalEventManager.onCharacterDeathServer += GlobalEventManagerOnonCharacterDeathServer;
			KarmaManager.SetKarmaServer += new Manipulator(KarmaManagerOnSetKarmaServer);
			CombatDirector.Spawn_SpawnCard_EliteDef_Transform_MonsterSpawnDistance_bool_float_PlacementMode_bool += new hook_Spawn_SpawnCard_EliteDef_Transform_MonsterSpawnDistance_bool_float_PlacementMode_bool(CombatDirectorOnSpawnPerfected);
			Stage.onStageStartGlobal += SpawnMasterlessMithry;
		}

		private void SpawnMasterlessMithry(Stage obj)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && !Object.op_Implicit((Object)(object)braindeadmithrix5000unitsunderthemap))
			{
				GameObject val = Object.Instantiate<GameObject>(BodyCatalog.FindBodyPrefab("BrotherBody"));
				Object.Destroy((Object)(object)val.GetComponent<KinematicCharacterMotor>());
				val.transform.position = new Vector3(val.transform.position.x, val.transform.position.y - 500000f, val.transform.position.z);
				((Behaviour)val.GetComponent<CharacterMotor>()).enabled = false;
				braindeadmithrix5000unitsunderthemap = val.GetComponent<CharacterBody>();
				NetworkServer.Spawn(val);
			}
		}

		private void GlobalEventManagerOnonCharacterDeathServer(DamageReport damageReport)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			if (Run.instance.lastCachedKarma > KarmaManager.maxKarma)
			{
				CharacterBody victimBody = damageReport.victimBody;
				EquipmentIndex? obj;
				if (victimBody == null)
				{
					obj = null;
				}
				else
				{
					Inventory inventory = victimBody.inventory;
					obj = ((inventory != null) ? new EquipmentIndex?(inventory.currentEquipmentIndex) : ((EquipmentIndex?)null));
				}
				EquipmentIndex? val = obj;
				EquipmentDef affixLunar = Equipment.AffixLunar;
				if (val == ((affixLunar != null) ? new EquipmentIndex?(affixLunar.equipmentIndex) : ((EquipmentIndex?)null)) || Run.instance.spawnRng.RangeFloat(0f, 100f) <= (float)((Run.instance.lastCachedKarma - KarmaManager.maxKarma) * 2))
				{
					BrotherUltUtils.EvaluatePattern(pizzaPatterns[Random.Range(0, pizzaPatterns.Count)], new BrotherUltContext
					{
						owner = ((Component)braindeadmithrix5000unitsunderthemap).gameObject,
						target = damageReport.attacker,
						originOverride = damageReport.victimBody.footPosition,
						useOriginOverride = true
					});
				}
			}
		}

		private void KarmaManagerOnonKarmaChangedServer(KarmaManager karmaManager, int newKarma)
		{
			if (Run.instance.lastCachedKarma <= KarmaManager.maxKarma)
			{
				return;
			}
			NetworkServer.Spawn(Object.Instantiate<GameObject>(ppEffect));
			Log.Debug("spawned ppv");
			if (!(Run.instance.spawnRng.RangeFloat(0f, 100f) <= (float)(20 + (Run.instance.lastCachedKarma - KarmaManager.maxKarma) * 5)))
			{
				return;
			}
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController._instances)
			{
				if (Object.op_Implicit((Object)(object)instance.body))
				{
					FireMassPillar(instance.body);
				}
			}
		}

		private void TeleporterInteractionOnOnBossDirectorSpawnedMonsterServer(orig_OnBossDirectorSpawnedMonsterServer orig, TeleporterInteraction self, GameObject masterobject)
		{
			orig.Invoke(self, masterobject);
			if (Run.instance.lastCachedKarma <= KarmaManager.maxKarma)
			{
				return;
			}
			masterobject.GetComponent<CharacterMaster>().onBodyStart += delegate(CharacterBody body)
			{
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
				if (Run.instance.spawnRng.RangeFloat(0f, 100f) <= (float)(15 + (Run.instance.lastCachedKarma - KarmaManager.maxKarma) * 5))
				{
					Vector3 val = default(Vector3);
					SceneInfo.instance.groundNodes.GetNodePosition(SceneInfo.instance.groundNodes.FindClosestNode(new Vector3(body.corePosition.x + (float)Random.Range(-100, 100), body.corePosition.y + (float)Random.Range(-100, 100), body.corePosition.z + (float)Random.Range(-100, 100)), (HullClassification)1, float.PositiveInfinity), ref val);
					if (val != Vector3.zero)
					{
						SpawnChimera(val);
					}
				}
			};
		}

		private void FireMassPillar(CharacterBody body)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(body.inputBank.aimOrigin, Vector3.down);
			RaycastHit val2 = default(RaycastHit);
			if (Util.CharacterRaycast(((Component)this).gameObject, val, ref val2, 1000f, ((LayerIndex)(ref LayerIndex.world)).mask, (QueryTriggerInteraction)0))
			{
				ProjectileManager.instance.FireProjectileWithoutDamageType(massProjectilePrefab, ((RaycastHit)(ref val2)).point, Quaternion.identity, (GameObject)null, body.damage, 0f, Util.CheckRoll(body.crit, body.master), (DamageColorIndex)0, (GameObject)null, -1f);
			}
		}

		private bool CombatDirectorOnSpawnPerfected(orig_Spawn_SpawnCard_EliteDef_Transform_MonsterSpawnDistance_bool_float_PlacementMode_bool orig, CombatDirector self, SpawnCard spawncard, EliteDef elitedef, Transform spawntarget, MonsterSpawnDistance spawndistance, bool preventoverhead, float valuemultiplier, PlacementMode placementmode, bool singlescaledboss)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			if (Run.instance.lastCachedKarma <= KarmaManager.maxKarma)
			{
				return orig.Invoke(self, spawncard, elitedef, spawntarget, spawndistance, preventoverhead, valuemultiplier, placementmode, singlescaledboss);
			}
			if (NetworkServer.active)
			{
				if (Run.instance.spawnRng.RangeFloat(0f, 100f) <= (float)((Run.instance.lastCachedKarma - KarmaManager.maxKarma) * 2))
				{
					elitedef = Elites.Lunar;
				}
				if (orig.Invoke(self, spawncard, elitedef, spawntarget, spawndistance, preventoverhead, valuemultiplier, placementmode, singlescaledboss))
				{
					if (Run.instance.spawnRng.RangeFloat(0f, 100f) <= (float)((Run.instance.lastCachedKarma - KarmaManager.maxKarma) * 3))
					{
						Vector3 val = default(Vector3);
						SceneInfo.instance.groundNodes.GetNodePosition(SceneInfo.instance.groundNodes.FindClosestNode(new Vector3(spawntarget.position.x + (float)Random.Range(-50, 50), spawntarget.position.y + (float)Random.Range(-25, 25), spawntarget.position.z + (float)Random.Range(-50, 50)), (HullClassification)1, float.PositiveInfinity), ref val);
						if (val != Vector3.zero)
						{
							SpawnChimera(val);
						}
					}
					return true;
				}
			}
			return orig.Invoke(self, spawncard, elitedef, spawntarget, spawndistance, preventoverhead, valuemultiplier, placementmode, singlescaledboss);
		}

		private void KarmaIconOnOnKarmaChanged(orig_OnKarmaChanged orig, KarmaIcon self, KarmaManager karmamanager, int karma)
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			orig.Invoke(self, karmamanager, Math.Clamp(karma, 0, KarmaManager.maxKarma));
			if (karma > KarmaManager.maxKarma)
			{
				Transform obj = ((Component)self).gameObject.transform.Find("Holder");
				object obj2;
				if (obj == null)
				{
					obj2 = null;
				}
				else
				{
					Transform obj3 = obj.Find("Addition");
					obj2 = ((obj3 != null) ? ((Component)obj3).gameObject : null);
				}
				GameObject val = (GameObject)obj2;
				if (!Object.op_Implicit((Object)(object)val))
				{
					val = new GameObject("Addition", new Type[1] { typeof(HGTextMeshProUGUI) });
					val.transform.SetParent(((Component)self).gameObject.transform.Find("Holder"), false);
				}
				((Transform)val.GetComponent<RectTransform>()).localPosition = new Vector3(108f, -19.5f, 0f);
				HGTextMeshProUGUI component = val.GetComponent<HGTextMeshProUGUI>();
				((TMP_Text)component).text = "+" + (karma - KarmaManager.maxKarma);
				((TMP_Text)component).fontSize = 10f;
				((Graphic)component).color = Color32.op_Implicit(new Color32((byte)134, (byte)185, byte.MaxValue, byte.MaxValue));
			}
		}

		private void KarmaManagerOnSetKarmaServer(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(KarmaManager), "maxKarma")
			}))
			{
				val.Remove();
				val.Emit(OpCodes.Ldc_I4, 99999);
			}
		}

		private int KarmaManagerOnGetEffectiveKarmaMultiplier(orig_GetEffectiveKarmaMultiplier orig, KarmaManager self)
		{
			return orig.Invoke(self) * ((!self.isKarmaEnabled) ? 1 : (karmaMultiplierUseAICount.Value ? (ThunderstoreInterface.aigenMods.Count + 1) : karmaMultiplier.Value));
		}

		public void SpawnChimera(Vector3 position)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			CharacterSpawnCard val = golemSpawnCard;
			if (Run.instance.spawnRng.RangeFloat(0f, 100f) < 50f)
			{
				val = wispSpawnCard;
			}
			DirectorSpawnRequest val2 = new DirectorSpawnRequest((SpawnCard)(object)val, new DirectorPlacementRule
			{
				placementMode = (PlacementMode)0,
				position = position
			}, RoR2Application.rng);
			val2.teamIndexOverride = (TeamIndex)2;
			val2.onSpawnedServer = (Action<SpawnResult>)Delegate.Combine(val2.onSpawnedServer, (Action<SpawnResult>)delegate(SpawnResult result)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
				if (NetworkServer.active)
				{
					GameObject spawnedInstance = result.spawnedInstance;
					CharacterMaster val4 = ((spawnedInstance != null) ? spawnedInstance.GetComponent<CharacterMaster>() : null);
					if (Object.op_Implicit((Object)(object)val4))
					{
						val4.inventory.GiveItemPermanent(Items.BoostDamage, Run.instance.lastCachedKarma);
						val4.inventory.GiveItemPermanent(Items.BoostHp, Run.instance.lastCachedKarma);
						val4.inventory.GiveItemPermanent(Items.BoostAttackSpeed, Run.instance.lastCachedKarma);
						if (Run.instance.spawnRng.RangeFloat(0f, 100f) <= (float)((Run.instance.lastCachedKarma - KarmaManager.maxKarma) * 2))
						{
							EquipmentState val5 = default(EquipmentState);
							((EquipmentState)(ref val5))..ctor(Equipment.AffixLunar.equipmentIndex, new FixedTimeStamp(Run.instance.fixedTime), (byte)1, false);
							val4.inventory.SetEquipment(val5, 0u);
						}
						GameObject bodyObject = val4.GetBodyObject();
						DeathRewards val6 = ((bodyObject != null) ? bodyObject.GetComponent<DeathRewards>() : null);
						if (Object.op_Implicit((Object)(object)val6))
						{
							float num2 = 6f;
							val6.spawnValue = (int)Mathf.Max(1f, num2);
							val6.expReward = (uint)Mathf.Max(1f, num2 * Run.instance.compensatedDifficultyCoefficient);
							val6.goldReward = (uint)Mathf.Max(1f, num2 * 2f * Run.instance.compensatedDifficultyCoefficient);
						}
					}
				}
			});
			DirectorCore.instance.TrySpawnObject(val2);
			EffectData val3 = new EffectData
			{
				origin = position
			};
			EffectManager.SpawnEffect(impactEffectPrefab, val3, true);
			uint num = 35 + 7 * TeamManager.instance.GetTeamLevel((TeamIndex)2);
			new BlastAttack
			{
				inflictor = ((Component)this).gameObject,
				baseDamage = num,
				baseForce = 400f,
				attackerFiltering = (AttackerFiltering)0,
				crit = false,
				falloffModel = (FalloffModel)1,
				attacker = null,
				bonusForce = Vector3.zero,
				damageColorIndex = (DamageColorIndex)0,
				position = position,
				procChainMask = default(ProcChainMask),
				procCoefficient = 1f,
				teamIndex = (TeamIndex)2,
				radius = 40f
			}.Fire();
		}
	}
	public static class Utils
	{
		public static void SliderConfig(float min, float max, ConfigEntry<float> config)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			StepSliderConfig val = new StepSliderConfig
			{
				max = max,
				min = min,
				FormatString = "{0:0}"
			};
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(config, val));
		}

		public static void SliderConfig(int min, int max, ConfigEntry<int> config)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			IntSliderConfig val = new IntSliderConfig
			{
				max = max,
				min = min,
				formatString = "{0:0}"
			};
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(config, val));
		}

		public static void CheckboxConfig(ConfigEntry<bool> config, bool restartRequired = false)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			CheckBoxConfig val = new CheckBoxConfig();
			((BaseOptionConfig)val).restartRequired = restartRequired;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(config, val));
		}

		public static void StringConfig(ConfigEntry<string> config)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			InputFieldConfig val = new InputFieldConfig();
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(config, val));
		}

		public static void KeyboardConfig(ConfigEntry<KeyboardShortcut> config)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			KeyBindConfig val = new KeyBindConfig();
			ModSettingsManager.AddOption((BaseOption)new KeyBindOption(config, val));
		}
	}
}