Decompiled source of VoidLemurian v1.1.0

VoidLemurian.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.LemurianMonster;
using HG.GeneralSerializer;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using VoidLemurian.States;

[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("VoidLemurian")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("VoidLemurian")]
[assembly: AssemblyTitle("VoidLemurian")]
[assembly: AssemblyVersion("1.1.0.0")]
[module: RefSafetyRules(11)]
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 VoidLemurian
{
	internal static class Asset
	{
		public static T Load<T>(string key) where T : Object
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			T val = Addressables.LoadAssetAsync<T>((object)key).WaitForCompletion();
			if (!Object.op_Implicit((Object)(object)val))
			{
				VoidLemurianPlugin.Log.LogError((object)("Missing game asset: " + key));
			}
			return val;
		}

		public static T EscObject<T>(string escKey, string fieldName) where T : Object
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			Object obj = FindEscField(escKey, fieldName)?.fieldValue.objectValue;
			return (T)(object)((obj is T) ? obj : null);
		}

		public static string EscString(string escKey, string fieldName)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			return FindEscField(escKey, fieldName)?.fieldValue.stringValue ?? "";
		}

		private static SerializedField? FindEscField(string escKey, string fieldName)
		{
			//IL_002b: 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)
			//IL_0032: 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)
			EntityStateConfiguration val = Asset.Load<EntityStateConfiguration>(escKey);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			SerializedField[] serializedFields = val.serializedFieldsCollection.serializedFields;
			foreach (SerializedField val2 in serializedFields)
			{
				if (val2.fieldName == fieldName)
				{
					return val2;
				}
			}
			VoidLemurianPlugin.Log.LogWarning((object)("Field " + fieldName + " not found in " + escKey));
			return null;
		}
	}
	internal static class Build
	{
		private static readonly FieldInfo SkillFamilyField = typeof(GenericSkill).GetField("_skillFamily", BindingFlags.Instance | BindingFlags.NonPublic);

		public static SkillDef Skill(string id, Type state, string machine, float cooldown, InterruptPriority priority, Sprite icon, params string[] keywords)
		{
			//IL_006f: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
			val.skillName = "VoidLemurian" + id;
			((Object)val).name = val.skillName;
			string text = "VOIDLEMURIAN_" + id.ToUpperInvariant();
			val.skillNameToken = text + "_NAME";
			val.skillDescriptionToken = text + "_DESCRIPTION";
			val.keywordTokens = keywords;
			val.icon = icon;
			val.activationStateMachineName = machine;
			val.activationState = new SerializableEntityStateType(state);
			val.interruptPriority = priority;
			val.baseRechargeInterval = cooldown;
			val.baseMaxStock = 1;
			val.rechargeStock = 1;
			val.requiredStock = 1;
			val.stockToConsume = 1;
			val.fullRestockOnAssign = true;
			val.cancelSprintingOnActivation = true;
			val.canceledFromSprinting = false;
			val.beginSkillCooldownOnSkillEnd = false;
			val.isCombatSkill = true;
			val.mustKeyPress = false;
			ContentAddition.AddSkillDef(val);
			return val;
		}

		public static SkillDef Passive(string id, Sprite icon, params string[] keywords)
		{
			SkillDef obj = Skill(id, typeof(Idle), "Weapon", 0f, (InterruptPriority)0, icon, keywords);
			obj.isCombatSkill = false;
			obj.cancelSprintingOnActivation = false;
			return obj;
		}

		public static void ClearSlots(GameObject body)
		{
			GenericSkill[] components = body.GetComponents<GenericSkill>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components[i]);
			}
		}

		public static GenericSkill Slot(GameObject body, string familyName, params SkillDef[] variants)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			SkillFamily val = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val).name = familyName;
			val.variants = (Variant[])(object)new Variant[variants.Length];
			for (int i = 0; i < variants.Length; i++)
			{
				Variant[] variants2 = val.variants;
				int num = i;
				Variant val2 = new Variant
				{
					skillDef = variants[i]
				};
				((Variant)(ref val2)).viewableNode = new Node(variants[i].skillNameToken, false, (Node)null);
				variants2[num] = val2;
			}
			ContentAddition.AddSkillFamily(val);
			GenericSkill val3 = body.AddComponent<GenericSkill>();
			val3.skillName = familyName;
			SkillFamilyField.SetValue(val3, val);
			return val3;
		}

		public static RendererInfo RendererInfo(Renderer renderer, Material material)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			return new RendererInfo
			{
				renderer = renderer,
				defaultMaterial = material,
				defaultShadowCastingMode = (ShadowCastingMode)1,
				ignoreOverlays = false
			};
		}

		public static Mesh VanillaMesh(string skinParamsKey, Renderer renderer)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_0085: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			SkinDefParams val = Asset.Load<SkinDefParams>(skinParamsKey);
			if (Object.op_Implicit((Object)(object)val) && val.meshReplacements != null)
			{
				MeshReplacement[] meshReplacements = val.meshReplacements;
				foreach (MeshReplacement val2 in meshReplacements)
				{
					if (!Object.op_Implicit((Object)(object)val2.renderer) || !(((Object)val2.renderer).name != ((Object)renderer).name) || val.meshReplacements.Length <= 1)
					{
						if (Object.op_Implicit((Object)(object)val2.mesh))
						{
							return val2.mesh;
						}
						if (val2.meshAddress != null && ((AssetReference)val2.meshAddress).RuntimeKeyIsValid())
						{
							return Addressables.LoadAssetAsync<Mesh>(((AssetReference)val2.meshAddress).RuntimeKey).WaitForCompletion();
						}
					}
				}
			}
			Renderer obj = ((renderer is SkinnedMeshRenderer) ? renderer : null);
			Mesh val3 = ((obj != null) ? ((SkinnedMeshRenderer)obj).sharedMesh : null);
			if (!Object.op_Implicit((Object)(object)val3))
			{
				VoidLemurianPlugin.Log.LogError((object)("No mesh found for " + ((Object)renderer).name + " in " + skinParamsKey + "; it will be invisible."));
			}
			return val3;
		}

		public static SkinnedMeshRenderer[] PrepareMeshes(GameObject model, string skinParamsKey, Material material)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			SkinnedMeshRenderer[] componentsInChildren = model.GetComponentsInChildren<SkinnedMeshRenderer>(true);
			RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length];
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].sharedMesh = VanillaMesh(skinParamsKey, (Renderer)(object)componentsInChildren[i]);
				array[i] = RendererInfo((Renderer)(object)componentsInChildren[i], material);
			}
			model.GetComponent<CharacterModel>().baseRendererInfos = array;
			return componentsInChildren;
		}

		public static SkinDef Skin(string id, GameObject model, SkinnedMeshRenderer[] meshes, Material material, Color top, Color right, Color bottom, Color left)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_008c: 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_0090: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[meshes.Length];
			MeshReplacement[] array2 = (MeshReplacement[])(object)new MeshReplacement[meshes.Length];
			for (int i = 0; i < meshes.Length; i++)
			{
				array[i] = RendererInfo((Renderer)(object)meshes[i], material);
				array2[i] = new MeshReplacement
				{
					renderer = (Renderer)(object)meshes[i],
					mesh = meshes[i].sharedMesh
				};
			}
			return Skins.CreateNewSkinDef(new SkinDefParamsInfo
			{
				Name = "skinVoidLemurian" + id,
				NameToken = "VOIDLEMURIAN_SKIN_" + id + "_NAME",
				Icon = Skins.CreateSkinIcon(top, right, bottom, left),
				RootObject = model,
				RendererInfos = array,
				BaseSkins = Array.Empty<SkinDef>(),
				MeshReplacements = array2,
				GameObjectActivations = Array.Empty<GameObjectActivation>(),
				ProjectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(),
				MinionSkinReplacements = Array.Empty<MinionSkinReplacement>()
			});
		}

		public static void ClearDrivers(GameObject master)
		{
			AISkillDriver[] components = master.GetComponents<AISkillDriver>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components[i]);
			}
		}

		public static AISkillDriver Driver(GameObject master, string name, SkillSlot slot, TargetType target, float minDistance, float maxDistance, MovementType movement, bool requireLoS = false, bool sprint = false)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Invalid comparison between Unknown and I4
			//IL_0059: 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)
			AISkillDriver obj = master.AddComponent<AISkillDriver>();
			obj.customName = name;
			obj.skillSlot = slot;
			obj.requireSkillReady = (int)slot != -1;
			obj.moveTargetType = target;
			obj.minDistance = minDistance;
			obj.maxDistance = maxDistance;
			obj.movementType = movement;
			obj.selectionRequiresTargetLoS = requireLoS;
			obj.activationRequiresTargetLoS = requireLoS;
			obj.aimType = (AimType)(((int)target == 2) ? 4 : 2);
			obj.shouldSprint = sprint;
			obj.buttonPressType = (ButtonPressType)0;
			return obj;
		}

		public static CharacterMaster Summon(GameObject masterPrefab, CharacterBody owner, Vector3 position, float lifetime, bool copyItems)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_006f: 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)
			if (!Object.op_Implicit((Object)(object)masterPrefab) || !Object.op_Implicit((Object)(object)owner))
			{
				return null;
			}
			Vector3 val = (Object.op_Implicit((Object)(object)owner.inputBank) ? owner.inputBank.aimDirection : ((Component)owner).transform.forward);
			val.y = 0f;
			CharacterMaster val2 = new MasterSummon
			{
				masterPrefab = masterPrefab,
				position = position,
				rotation = Util.QuaternionSafeLookRotation(val),
				summonerBodyObject = ((Component)owner).gameObject,
				ignoreTeamMemberLimit = true,
				inventoryToCopy = (copyItems ? owner.inventory : null)
			}.Perform();
			if (Object.op_Implicit((Object)(object)val2) && lifetime > 0f)
			{
				((Component)val2).gameObject.AddComponent<MasterSuicideOnTimer>().lifeTimer = lifetime;
			}
			if (Object.op_Implicit((Object)(object)val2) && copyItems && Object.op_Implicit((Object)(object)owner.master))
			{
				InventorySync.Attach(val2, owner.master);
			}
			return val2;
		}

		public static Vector3 GroundPoint(Vector3 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//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_0029: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = position + Vector3.up * 2.5f;
			Vector3 down = Vector3.down;
			LayerIndex world = LayerIndex.world;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, down, ref val2, 40f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
			{
				return ((RaycastHit)(ref val2)).point;
			}
			return position;
		}

		public static Vector3 AimedGroundPoint(Ray aimRay, float maxRange)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_0029: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			Ray val = aimRay;
			LayerIndex world = LayerIndex.world;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, ref val2, maxRange, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
			{
				return ((RaycastHit)(ref val2)).point;
			}
			return GroundPoint(((Ray)(ref aimRay)).GetPoint(maxRange));
		}
	}
	public class InventorySync : MonoBehaviour
	{
		private Inventory source;

		private Inventory target;

		public static void Attach(CharacterMaster minion, CharacterMaster owner)
		{
			if (Object.op_Implicit((Object)(object)minion.inventory) && Object.op_Implicit((Object)(object)owner.inventory))
			{
				InventorySync inventorySync = ((Component)minion).gameObject.AddComponent<InventorySync>();
				inventorySync.source = owner.inventory;
				inventorySync.target = minion.inventory;
				inventorySync.source.onInventoryChanged += inventorySync.Copy;
			}
		}

		private void Copy()
		{
			if (Object.op_Implicit((Object)(object)source) && Object.op_Implicit((Object)(object)target))
			{
				target.CopyItemsFrom(source, Inventory.defaultItemCopyFilterDelegate);
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)source))
			{
				source.onInventoryChanged -= Copy;
			}
		}
	}
	public class SummonTracker : MonoBehaviour
	{
		private readonly Dictionary<string, List<CharacterMaster>> groups = new Dictionary<string, List<CharacterMaster>>();

		public static void Track(CharacterBody owner, string group, CharacterMaster minion, int max)
		{
			if (Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)owner.master) && Object.op_Implicit((Object)(object)minion))
			{
				SummonTracker summonTracker = ((Component)owner.master).GetComponent<SummonTracker>();
				if (!Object.op_Implicit((Object)(object)summonTracker))
				{
					summonTracker = ((Component)owner.master).gameObject.AddComponent<SummonTracker>();
				}
				if (!summonTracker.groups.TryGetValue(group, out var value))
				{
					value = new List<CharacterMaster>();
					summonTracker.groups[group] = value;
				}
				value.RemoveAll((CharacterMaster m) => !Object.op_Implicit((Object)(object)m) || !Object.op_Implicit((Object)(object)m.GetBody()));
				value.Add(minion);
				while (value.Count > max)
				{
					value[0].TrueKill();
					value.RemoveAt(0);
				}
			}
		}
	}
	internal static class LemurianPassive
	{
		public const float CollapseChance = 15f;

		public const float HealFraction = 0.05f;

		public static void Hook()
		{
			GlobalEventManager.onServerDamageDealt += OnServerDamageDealt;
			GlobalEventManager.onCharacterDeathGlobal += OnCharacterDeath;
		}

		public static bool HasSkill(CharacterBody body, SkillDef skill)
		{
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.skillLocator) && Object.op_Implicit((Object)(object)skill))
			{
				return Object.op_Implicit((Object)(object)body.skillLocator.FindSkillByDef(skill));
			}
			return false;
		}

		private static bool HasDevouringAbyss(CharacterBody body)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_001c: Invalid comparison between Unknown and I4
			if (Object.op_Implicit((Object)(object)body) && body.bodyIndex == LemurianSurvivor.BodyIndex && (int)body.bodyIndex != -1)
			{
				return HasSkill(body, LemurianSurvivor.DevouringPassive);
			}
			return false;
		}

		private static void OnServerDamageDealt(DamageReport report)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Invalid comparison between Unknown and I4
			DamageInfo damageInfo = report.damageInfo;
			if (HasDevouringAbyss(report.attackerBody) && Object.op_Implicit((Object)(object)report.victimBody) && damageInfo != null && !damageInfo.rejected && (int)report.dotType == -1 && !(damageInfo.procCoefficient <= 0f) && Util.CheckRoll(15f * damageInfo.procCoefficient, report.attackerMaster))
			{
				InflictCollapse(((Component)report.victim).gameObject, report.attacker);
			}
		}

		public static void InflictCollapse(GameObject victim, GameObject attacker)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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)
			InflictDotInfo val = new InflictDotInfo
			{
				victimObject = victim,
				attackerObject = attacker,
				dotIndex = (DotIndex)8,
				duration = 3f,
				damageMultiplier = 1f
			};
			DotController.InflictDot(ref val);
		}

		private static void OnCharacterDeath(DamageReport report)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			//IL_005d: 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)
			if (HasDevouringAbyss(report.attackerBody) && Object.op_Implicit((Object)(object)report.victimBody) && ((int)report.dotType == 8 || report.victimBody.HasBuff(Buffs.Fracture)) && Object.op_Implicit((Object)(object)report.attackerBody.healthComponent))
			{
				report.attackerBody.healthComponent.HealFraction(0.05f, default(ProcChainMask));
			}
		}
	}
	internal static class LemurianProjectiles
	{
		public static GameObject VoidBolt;

		public static GameObject BarrageBolt;

		public static GameObject HorizonOrb;

		public static GameObject Singularity;

		public static GameObject NullDomain;

		public const float HorizonOrbDamage = 3f;

		public const float SingularityPulseDamage = 0.5f;

		public const float SingularityImplodeDamage = 10f;

		public const float SingularityRadius = 14f;

		public const float SingularityDuration = 3f;

		public const float NullDomainPulseDamage = 0.4f;

		public const float NullDomainExplosionDamage = 10f;

		public const float NullDomainExecuteThreshold = 0.3f;

		public static void Create()
		{
			CreateVoidBolt();
			CreateBarrageBolt();
			CreateSingularity();
			CreateHorizonOrb();
			CreateNullDomain();
		}

		public static DamageTypeCombo FromSkill(DamageSource source)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, source);
		}

		private static void CreateVoidBolt()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			VoidBolt = PrefabAPI.InstantiateClone(Asset.Load<GameObject>("RoR2/DLC1/VoidSurvivor/VoidSurvivorMegaBlasterSmallProjectile.prefab"), "VoidLemurianBoltProjectile", true);
			ProjectileSimple component = VoidBolt.GetComponent<ProjectileSimple>();
			component.desiredForwardSpeed = 120f;
			component.lifetime = 2f;
			VoidBolt.GetComponent<ProjectileDamage>().damageType = FromSkill((DamageSource)1);
			ProjectileController component2 = VoidBolt.GetComponent<ProjectileController>();
			GameObject val = PrefabAPI.InstantiateClone(component2.ghostPrefab, "VoidLemurianBoltGhost", false);
			Transform transform = val.transform;
			transform.localScale *= 1.6f;
			component2.ghostPrefab = val;
			ContentAddition.AddProjectile(VoidBolt);
		}

		private static void CreateBarrageBolt()
		{
			BarrageBolt = PrefabAPI.InstantiateClone(VoidBolt, "VoidLemurianBarrageProjectile", true);
			Object.DestroyImmediate((Object)(object)BarrageBolt.GetComponent<ProjectileSteerTowardTarget>());
			BarrageBolt.GetComponent<ProjectileSimple>().desiredForwardSpeed = 140f;
			ContentAddition.AddProjectile(BarrageBolt);
		}

		private static void CreateNullDomain()
		{
			//IL_0025: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			NullDomain = PrefabAPI.InstantiateClone(Asset.Load<GameObject>("RoR2/Base/Nullifier/NullifierDeathBombProjectile.prefab"), "VoidLemurianNullDomain", true);
			NullDomain.GetComponent<ProjectileDamage>().damageType = FromSkill((DamageSource)8);
			ProjectileImpactExplosion component = NullDomain.GetComponent<ProjectileImpactExplosion>();
			((ProjectileExplosion)component).blastAttackerFiltering = (AttackerFiltering)2;
			((ProjectileExplosion)component).blastDamageCoefficient = 10f;
			((ProjectileExplosion)component).blastProcCoefficient = 1f;
			((ProjectileExplosion)component).falloffModel = (FalloffModel)0;
			((ProjectileExplosion)component).fireChildren = false;
			NullDomain.AddComponent<NullDomainController>();
			ContentAddition.AddProjectile(NullDomain);
		}

		private static void CreateSingularity()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			Singularity = PrefabAPI.InstantiateClone(Asset.Load<GameObject>("RoR2/DLC1/ElementalRingVoid/ElementalRingVoidBlackHole.prefab"), "VoidLemurianSingularity", true);
			Object.DestroyImmediate((Object)(object)Singularity.GetComponent<ProjectileExplosion>());
			Object.DestroyImmediate((Object)(object)Singularity.GetComponent<ProjectileFuse>());
			Singularity.GetComponent<ProjectileSimple>().lifetime = 4f;
			Singularity.GetComponent<ProjectileDamage>().damageType = FromSkill((DamageSource)8);
			RadialForce component = Singularity.GetComponent<RadialForce>();
			component.radius = 14f;
			component.forceMagnitude = -1800f;
			ObjectScaleCurve[] componentsInChildren = Singularity.GetComponentsInChildren<ObjectScaleCurve>(true);
			foreach (ObjectScaleCurve val in componentsInChildren)
			{
				if (val.timeMax > 1f)
				{
					val.timeMax = 3f;
				}
			}
			Singularity.AddComponent<SingularityController>();
			ContentAddition.AddProjectile(Singularity);
		}

		private static void CreateHorizonOrb()
		{
			//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_0088: 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_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)
			HorizonOrb = PrefabAPI.InstantiateClone(Asset.Load<GameObject>("RoR2/DLC1/VoidSurvivor/VoidSurvivorMegaBlasterBigProjectile.prefab"), "VoidLemurianHorizonOrb", true);
			HorizonOrb.GetComponent<ProjectileSimple>().desiredForwardSpeed = 65f;
			HorizonOrb.GetComponent<ProjectileDamage>().damageType = FromSkill((DamageSource)8);
			ProjectileImpactExplosion component = HorizonOrb.GetComponent<ProjectileImpactExplosion>();
			component.lifetime = 1.4f;
			((ProjectileExplosion)component).blastRadius = 7f;
			((ProjectileExplosion)component).fireChildren = true;
			((ProjectileExplosion)component).childrenProjectilePrefab = Singularity;
			((ProjectileExplosion)component).childrenCount = 1;
			((ProjectileExplosion)component).childrenDamageCoefficient = 1f / 3f;
			((ProjectileExplosion)component).minAngleOffset = Vector3.zero;
			((ProjectileExplosion)component).maxAngleOffset = Vector3.zero;
			ContentAddition.AddProjectile(HorizonOrb);
		}
	}
	public class SingularityController : MonoBehaviour
	{
		private const float PulseInterval = 1f / 3f;

		private ProjectileController projectileController;

		private ProjectileDamage projectileDamage;

		private float age;

		private float pulseTimer;

		private bool imploded;

		private void Awake()
		{
			projectileController = ((Component)this).GetComponent<ProjectileController>();
			projectileDamage = ((Component)this).GetComponent<ProjectileDamage>();
		}

		private void FixedUpdate()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && !imploded)
			{
				age += Time.fixedDeltaTime;
				pulseTimer -= Time.fixedDeltaTime;
				if (pulseTimer <= 0f)
				{
					pulseTimer += 1f / 3f;
					Blast(0.5f, 0.3f, (FalloffModel)0);
				}
				if (age >= 3f)
				{
					imploded = true;
					Implode();
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
		}

		private void Implode()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0038: 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_0053: 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_0065: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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)
			EffectManager.SpawnEffect(VoidAssets.ImplodeEffect, new EffectData
			{
				origin = ((Component)this).transform.position,
				scale = 14f
			}, true);
			Result val = Blast(10f, 1f, (FalloffModel)0);
			GameObject owner = projectileController.owner;
			if (!Object.op_Implicit((Object)(object)owner))
			{
				return;
			}
			HitPoint[] hitPoints = val.hitPoints;
			foreach (HitPoint val2 in hitPoints)
			{
				if (Object.op_Implicit((Object)(object)val2.hurtBox) && Object.op_Implicit((Object)(object)val2.hurtBox.healthComponent) && val2.hurtBox.healthComponent.alive)
				{
					LemurianPassive.InflictCollapse(((Component)val2.hurtBox.healthComponent).gameObject, owner);
				}
			}
		}

		private Result Blast(float coefficient, float procCoefficient, FalloffModel falloff)
		{
			//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)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00c1: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			GameObject owner = projectileController.owner;
			return new BlastAttack
			{
				attacker = owner,
				inflictor = ((Component)this).gameObject,
				teamIndex = (Object.op_Implicit((Object)(object)projectileController.teamFilter) ? projectileController.teamFilter.teamIndex : TeamComponent.GetObjectTeam(owner)),
				position = ((Component)this).transform.position,
				radius = 14f,
				baseDamage = projectileDamage.damage * coefficient,
				baseForce = 0f,
				crit = projectileDamage.crit,
				damageType = LemurianProjectiles.FromSkill((DamageSource)8),
				damageColorIndex = (DamageColorIndex)9,
				falloffModel = falloff,
				procCoefficient = procCoefficient,
				attackerFiltering = (AttackerFiltering)2
			}.Fire();
		}
	}
	public class NullDomainController : MonoBehaviour
	{
		private const float PulseInterval = 1f / 3f;

		private ProjectileController projectileController;

		private ProjectileDamage projectileDamage;

		private ProjectileImpactExplosion explosion;

		private float pulseTimer = 1f / 3f;

		private void Awake()
		{
			projectileController = ((Component)this).GetComponent<ProjectileController>();
			projectileDamage = ((Component)this).GetComponent<ProjectileDamage>();
			explosion = ((Component)this).GetComponent<ProjectileImpactExplosion>();
			ProjectileImpactExplosion obj = explosion;
			((ProjectileExplosion)obj).OnProjectileExplosion = (Action<BlastAttack, Result>)Delegate.Combine(((ProjectileExplosion)obj).OnProjectileExplosion, new Action<BlastAttack, Result>(OnExplosion));
		}

		private void FixedUpdate()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_0095: 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_00b0: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_00f2: 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_0109: 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)
			if (NetworkServer.active)
			{
				pulseTimer -= Time.fixedDeltaTime;
				if (!(pulseTimer > 0f))
				{
					pulseTimer += 1f / 3f;
					GameObject owner = projectileController.owner;
					new BlastAttack
					{
						attacker = owner,
						inflictor = ((Component)this).gameObject,
						teamIndex = (Object.op_Implicit((Object)(object)projectileController.teamFilter) ? projectileController.teamFilter.teamIndex : TeamComponent.GetObjectTeam(owner)),
						position = ((Component)this).transform.position,
						radius = ((ProjectileExplosion)explosion).blastRadius,
						baseDamage = projectileDamage.damage * 0.4f,
						baseForce = 0f,
						crit = projectileDamage.crit,
						damageType = LemurianProjectiles.FromSkill((DamageSource)8),
						damageColorIndex = (DamageColorIndex)9,
						falloffModel = (FalloffModel)0,
						procCoefficient = 0.25f,
						attackerFiltering = (AttackerFiltering)2
					}.Fire();
				}
			}
		}

		private void OnExplosion(BlastAttack attack, Result result)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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)
			GameObject owner = projectileController.owner;
			HitPoint[] hitPoints = result.hitPoints;
			foreach (HitPoint val in hitPoints)
			{
				HealthComponent val2 = (Object.op_Implicit((Object)(object)val.hurtBox) ? val.hurtBox.healthComponent : null);
				if (Object.op_Implicit((Object)(object)val2) && val2.alive && Object.op_Implicit((Object)(object)val2.body) && !val2.body.isBoss && !val2.body.isChampion && val2.combinedHealthFraction <= 0.3f)
				{
					val2.Suicide(owner, ((Component)this).gameObject, DamageTypeCombo.op_Implicit((DamageType)65536));
				}
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)explosion))
			{
				ProjectileImpactExplosion obj = explosion;
				((ProjectileExplosion)obj).OnProjectileExplosion = (Action<BlastAttack, Result>)Delegate.Remove(((ProjectileExplosion)obj).OnProjectileExplosion, new Action<BlastAttack, Result>(OnExplosion));
			}
		}
	}
	internal static class LemurianSurvivor
	{
		public const string BodyName = "VoidLemurianBody";

		private const float DisplayScale = 0.19f;

		private const string VanillaSkinParams = "RoR2/Base/LemurianBruiser/skinLemurianBruiserBodyDefault_params.asset";

		public static GameObject BodyPrefab;

		public static GameObject DisplayPrefab;

		public static GameObject MasterPrefab;

		public static SurvivorDef Survivor;

		public static BodyIndex BodyIndex = (BodyIndex)(-1);

		public static SkillDef DevouringPassive;

		public static SkillDef RebirthPassive;

		public static SkillDef VoidRiftSkill;

		public static void Create()
		{
			RegisterStates();
			CreateBody();
			CreateSkills();
			CreateSkins();
			CreateDisplay();
			CreateSurvivorDef();
			CreateMaster();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				BodyIndex = BodyCatalog.FindBodyIndex(BodyPrefab);
			});
		}

		private static void RegisterStates()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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)
			bool flag = default(bool);
			ContentAddition.AddEntityState<VoidLemurianMain>(ref flag);
			ContentAddition.AddEntityState<FireVoidBolt>(ref flag);
			ContentAddition.AddEntityState<FireVoidBarrage>(ref flag);
			ContentAddition.AddEntityState<NullBreath>(ref flag);
			ContentAddition.AddEntityState<BroodCall>(ref flag);
			ContentAddition.AddEntityState<VoidRift>(ref flag);
			ContentAddition.AddEntityState<SummonVoidMirror>(ref flag);
			ContentAddition.AddEntityState<ChargeEventHorizon>(ref flag);
			ContentAddition.AddEntityState<FireEventHorizon>(ref flag);
			ContentAddition.AddEntityState<BarnacleNest>(ref flag);
			ContentAddition.AddEntityState<CastNullDomain>(ref flag);
			ContentAddition.AddEntityState<WhelpSpit>(ref flag);
		}

		private static void CreateBody()
		{
			//IL_004f: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			BodyPrefab = PrefabAPI.InstantiateClone(Asset.Load<GameObject>("RoR2/Base/LemurianBruiser/LemurianBruiserBody.prefab"), "VoidLemurianBody", true);
			Shrink(VoidLemurianPlugin.BodySize.Value);
			CharacterBody component = BodyPrefab.GetComponent<CharacterBody>();
			component.baseNameToken = "VOIDLEMURIAN_NAME";
			component.subtitleNameToken = "VOIDLEMURIAN_SUBTITLE";
			component.bodyFlags = (BodyFlags)1040;
			component.portraitIcon = (Texture)(object)VoidAssets.Portrait;
			component.bodyColor = VoidAssets.VoidPurple;
			component.preferredPodPrefab = VoidAssets.SurvivorPod;
			component.hullClassification = (HullClassification)1;
			component.isChampion = false;
			component.autoCalculateLevelStats = false;
			component.baseMaxHealth = 160f;
			component.levelMaxHealth = 48f;
			component.baseRegen = 1.5f;
			component.levelRegen = 0.3f;
			component.baseArmor = 20f;
			component.levelArmor = 0f;
			component.baseDamage = 12f;
			component.levelDamage = 2.4f;
			component.baseAttackSpeed = 1f;
			component.baseCrit = 1f;
			component.baseMoveSpeed = 7f;
			component.levelMoveSpeed = 0f;
			component.baseAcceleration = 60f;
			component.baseJumpPower = 17f;
			component.baseJumpCount = 1;
			component.sprintingSpeedMultiplier = 1.45f;
			BodyPrefab.GetComponent<CharacterDirection>().turnSpeed = 480f;
			BodyPrefab.GetComponent<Interactor>().maxInteractionDistance = 5f;
			BodyPrefab.GetComponent<SetStateOnHurt>().canBeHitStunned = false;
			BodyPrefab.GetComponent<CameraTargetParams>().cameraParams = Asset.Load<GameObject>("RoR2/Base/Croco/CrocoBody.prefab").GetComponent<CameraTargetParams>().cameraParams;
			Object.DestroyImmediate((Object)(object)BodyPrefab.GetComponent<DeathRewards>());
			EntityStateMachine[] components = BodyPrefab.GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val in components)
			{
				if (val.customName == "Body")
				{
					val.initialStateType = new SerializableEntityStateType(typeof(VoidLemurianMain));
					val.mainStateType = new SerializableEntityStateType(typeof(VoidLemurianMain));
				}
			}
			ContentAddition.AddBody(BodyPrefab);
		}

		private static void Shrink(float scale)
		{
			//IL_0018: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			foreach (Transform item in BodyPrefab.transform)
			{
				item.localPosition *= scale;
			}
			Transform modelTransform = BodyPrefab.GetComponent<ModelLocator>().modelTransform;
			modelTransform.localScale *= scale;
			CapsuleCollider component = BodyPrefab.GetComponent<CapsuleCollider>();
			BodyPrefab.GetComponent<KinematicCharacterMotor>().SetCapsuleDimensions(component.radius * scale, component.height * scale, component.center.y * scale);
		}

		private static void CreateSkills()
		{
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			DevouringPassive = Build.Passive("DevouringAbyss", VoidAssets.PassiveIcon, "VOIDLEMURIAN_KEYWORD_COLLAPSE");
			RebirthPassive = Build.Passive("VoidRebirth", VoidAssets.RebirthIcon);
			SkillDef val = Build.Skill("VoidBolt", typeof(FireVoidBolt), "Weapon", 0f, (InterruptPriority)0, VoidAssets.PrimaryIcon);
			SkillDef val2 = Build.Skill("VoidBarrage", typeof(FireVoidBarrage), "Weapon", 0f, (InterruptPriority)0, VoidAssets.BarrageIcon);
			SkillDef val3 = Build.Skill("NullBreath", typeof(NullBreath), "Weapon", 5f, (InterruptPriority)1, VoidAssets.SecondaryIcon, "VOIDLEMURIAN_KEYWORD_NULLIFY");
			SkillDef val4 = Build.Skill("BroodCall", typeof(BroodCall), "Weapon", 12f, (InterruptPriority)1, VoidAssets.BroodIcon);
			val4.mustKeyPress = true;
			VoidRiftSkill = Build.Skill("VoidRift", typeof(VoidRift), "Body", 6f, (InterruptPriority)2, VoidAssets.UtilityIcon, "VOIDLEMURIAN_KEYWORD_NULLIFY");
			VoidRiftSkill.cancelSprintingOnActivation = false;
			VoidRiftSkill.mustKeyPress = true;
			SkillDef val5 = Build.Skill("VoidMirror", typeof(SummonVoidMirror), "Body", 16f, (InterruptPriority)2, VoidAssets.MirrorIcon, "VOIDLEMURIAN_KEYWORD_NULLIFY");
			val5.cancelSprintingOnActivation = false;
			val5.mustKeyPress = true;
			SkillDef val6 = Build.Skill("EventHorizon", typeof(ChargeEventHorizon), "Weapon", 12f, (InterruptPriority)1, VoidAssets.SpecialIcon, "VOIDLEMURIAN_KEYWORD_COLLAPSE");
			val6.mustKeyPress = true;
			SkillDef val7 = Build.Skill("BarnacleNest", typeof(BarnacleNest), "Weapon", 20f, (InterruptPriority)1, VoidAssets.BarnacleIcon);
			val7.mustKeyPress = true;
			SkillDef val8 = Build.Skill("NullDomain", typeof(CastNullDomain), "Weapon", 14f, (InterruptPriority)1, VoidAssets.NullDomainIcon);
			val8.mustKeyPress = true;
			Build.ClearSlots(BodyPrefab);
			SkillLocator component = BodyPrefab.GetComponent<SkillLocator>();
			Build.Slot(BodyPrefab, "VoidLemurianPassiveFamily", DevouringPassive, RebirthPassive).loadoutTitleToken = "VOIDLEMURIAN_LOADOUT_PASSIVE";
			component.primary = Build.Slot(BodyPrefab, "VoidLemurianPrimaryFamily", val, val2);
			component.secondary = Build.Slot(BodyPrefab, "VoidLemurianSecondaryFamily", val3, val4);
			component.utility = Build.Slot(BodyPrefab, "VoidLemurianUtilityFamily", VoidRiftSkill, val5);
			component.special = Build.Slot(BodyPrefab, "VoidLemurianSpecialFamily", val6, val7, val8);
			component.passiveSkill = new PassiveSkill
			{
				enabled = false
			};
		}

		private static void CreateSkins()
		{
			//IL_0041: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: 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)
			GameObject gameObject = ((Component)BodyPrefab.GetComponent<ModelLocator>().modelTransform).gameObject;
			SkinnedMeshRenderer[] meshes = Build.PrepareMeshes(gameObject, "RoR2/Base/LemurianBruiser/skinLemurianBruiserBodyDefault_params.asset", VoidAssets.AbyssMaterial);
			SkinDef val = Build.Skin("ABYSS", gameObject, meshes, VoidAssets.AbyssMaterial, new Color(0.09f, 0.03f, 0.18f), new Color(0.62f, 0.22f, 1f), new Color(0.24f, 0.08f, 0.42f), new Color(1f, 0.45f, 1f));
			SkinDef val2 = Build.Skin("STARLESS", gameObject, meshes, VoidAssets.StarlessMaterial, new Color(0.02f, 0.02f, 0.04f), new Color(0.55f, 0.9f, 1f), new Color(0.13f, 0.15f, 0.25f), new Color(0.92f, 0.96f, 1f));
			SkinDef val3 = Build.Skin("ELDER", gameObject, meshes, VoidAssets.ElderMaterial, new Color(0.55f, 0.18f, 0.1f), new Color(0.95f, 0.6f, 0.2f), new Color(0.35f, 0.25f, 0.15f), new Color(0.86f, 0.73f, 0.27f));
			gameObject.GetComponent<ModelSkinController>().skins = (SkinDef[])(object)new SkinDef[3] { val, val2, val3 };
		}

		private static void CreateDisplay()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			DisplayPrefab = PrefabAPI.InstantiateClone(((Component)BodyPrefab.GetComponent<ModelLocator>().modelTransform).gameObject, "VoidLemurianDisplay", false);
			DisplayPrefab.transform.localScale = Vector3.one * 0.095f;
			Object.DestroyImmediate((Object)(object)DisplayPrefab.GetComponent<HurtBoxGroup>());
			HurtBox[] componentsInChildren = DisplayPrefab.GetComponentsInChildren<HurtBox>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)((Component)componentsInChildren[i]).gameObject);
			}
			AimAssistTarget[] componentsInChildren2 = DisplayPrefab.GetComponentsInChildren<AimAssistTarget>(true);
			for (int i = 0; i < componentsInChildren2.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)((Component)componentsInChildren2[i]).gameObject);
			}
			Object.DestroyImmediate((Object)(object)DisplayPrefab.GetComponent<AimAnimator>());
			Object.DestroyImmediate((Object)(object)DisplayPrefab.GetComponent<FootstepHandler>());
			DisplayPrefab.GetComponent<CharacterModel>().body = null;
		}

		private static void CreateSurvivorDef()
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			Survivor = ScriptableObject.CreateInstance<SurvivorDef>();
			Survivor.cachedName = "VoidLemurian";
			Survivor.bodyPrefab = BodyPrefab;
			Survivor.displayPrefab = DisplayPrefab;
			Survivor.displayNameToken = "VOIDLEMURIAN_NAME";
			Survivor.descriptionToken = "VOIDLEMURIAN_DESCRIPTION";
			Survivor.outroFlavorToken = "VOIDLEMURIAN_OUTRO_FLAVOR";
			Survivor.mainEndingEscapeFailureFlavorToken = "VOIDLEMURIAN_OUTRO_FAILURE";
			Survivor.primaryColor = VoidAssets.VoidPurple;
			Survivor.desiredSortPosition = 100f;
			ContentAddition.AddSurvivorDef(Survivor);
		}

		private static void CreateMaster()
		{
			MasterPrefab = PrefabAPI.InstantiateClone(Asset.Load<GameObject>("RoR2/Base/LemurianBruiser/LemurianBruiserMaster.prefab"), "VoidLemurianMonsterMaster", true);
			MasterPrefab.GetComponent<CharacterMaster>().bodyPrefab = BodyPrefab;
			Build.ClearDrivers(MasterPrefab);
			Build.Driver(MasterPrefab, "Breath", (SkillSlot)1, (TargetType)0, 0f, 20f, (MovementType)2, requireLoS: true);
			Build.Driver(MasterPrefab, "Special", (SkillSlot)3, (TargetType)0, 0f, 45f, (MovementType)2, requireLoS: true);
			Build.Driver(MasterPrefab, "Bolt", (SkillSlot)0, (TargetType)0, 0f, 60f, (MovementType)2, requireLoS: true);
			Build.Driver(MasterPrefab, "Chase", (SkillSlot)(-1), (TargetType)0, 0f, float.PositiveInfinity, (MovementType)1, requireLoS: false, sprint: true);
			Build.Driver(MasterPrefab, "ReturnToLeader", (SkillSlot)(-1), (TargetType)2, 15f, float.PositiveInfinity, (MovementType)1, requireLoS: false, sprint: true);
			Build.Driver(MasterPrefab, "Idle", (SkillSlot)(-1), (TargetType)2, 0f, float.PositiveInfinity, (MovementType)0);
			ContentAddition.AddMaster(MasterPrefab);
		}
	}
	internal static class Summons
	{
		public const float MirrorBurstRadius = 12f;

		public const float MirrorBurstDamage = 4f;

		public static GameObject WhelpBody;

		public static GameObject WhelpMaster;

		public static GameObject MirrorBody;

		public static GameObject MirrorMaster;

		public static BodyIndex MirrorBodyIndex = (BodyIndex)(-1);

		public static void Create()
		{
			CreateWhelp();
			CreateWhelpMaster();
			CreateMirror();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				MirrorBodyIndex = BodyCatalog.FindBodyIndex(MirrorBody);
			});
			GlobalEventManager.onCharacterDeathGlobal += OnCharacterDeath;
		}

		private static void CreateWhelp()
		{
			//IL_003c: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			WhelpBody = PrefabAPI.InstantiateClone(Asset.Load<GameObject>("RoR2/Base/Lemurian/LemurianBody.prefab"), "VoidLemurianWhelpBody", true);
			CharacterBody component = WhelpBody.GetComponent<CharacterBody>();
			component.baseNameToken = "VOIDLEMURIAN_WHELP_NAME";
			component.subtitleNameToken = "VOIDLEMURIAN_WHELP_SUBTITLE";
			component.bodyFlags = (BodyFlags)(component.bodyFlags | 0x410);
			component.portraitIcon = (Texture)(object)VoidAssets.WhelpPortrait;
			component.bodyColor = VoidAssets.VoidPurple;
			component.autoCalculateLevelStats = false;
			component.baseMaxHealth = 110f;
			component.levelMaxHealth = 33f;
			component.baseRegen = 1f;
			component.levelRegen = 0.2f;
			component.baseDamage = 12f;
			component.levelDamage = 2.4f;
			component.baseArmor = 0f;
			component.baseMoveSpeed = 9f;
			component.baseJumpPower = 16f;
			DeathRewards component2 = WhelpBody.GetComponent<DeathRewards>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				Object.DestroyImmediate((Object)(object)component2);
			}
			SetStateOnHurt component3 = WhelpBody.GetComponent<SetStateOnHurt>();
			if (Object.op_Implicit((Object)(object)component3))
			{
				component3.canBeHitStunned = false;
			}
			if (!Object.op_Implicit((Object)(object)WhelpBody.GetComponent<Interactor>()))
			{
				WhelpBody.AddComponent<Interactor>().maxInteractionDistance = 3f;
			}
			if (!Object.op_Implicit((Object)(object)WhelpBody.GetComponent<InteractionDriver>()))
			{
				WhelpBody.AddComponent<InteractionDriver>();
			}
			if (!Object.op_Implicit((Object)(object)WhelpBody.GetComponent<EquipmentSlot>()))
			{
				WhelpBody.AddComponent<EquipmentSlot>();
			}
			EntityStateMachine[] components = WhelpBody.GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val in components)
			{
				if (val.customName == "Body")
				{
					val.mainStateType = new SerializableEntityStateType(typeof(VoidLemurianMain));
				}
			}
			CreateWhelpSkills();
			CreateWhelpSkin();
			ContentAddition.AddBody(WhelpBody);
		}

		private static void CreateWhelpSkills()
		{
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			SkillDef val = Asset.Load<SkillDef>("RoR2/Base/Lemurian/LemurianBodyBite.asset");
			SkillDef val2 = Build.Skill("WhelpSpit", typeof(WhelpSpit), "Weapon", 0f, (InterruptPriority)0, VoidAssets.PrimaryIcon);
			SkillDef val3 = Build.Skill("WhelpBite", typeof(Bite), Object.op_Implicit((Object)(object)val) ? val.activationStateMachineName : "Weapon", 1.5f, (InterruptPriority)1, VoidAssets.BiteIcon);
			Build.ClearSlots(WhelpBody);
			SkillLocator component = WhelpBody.GetComponent<SkillLocator>();
			component.primary = Build.Slot(WhelpBody, "VoidLemurianWhelpPrimaryFamily", val2);
			component.secondary = Build.Slot(WhelpBody, "VoidLemurianWhelpSecondaryFamily", val3);
			component.utility = Build.Slot(WhelpBody, "VoidLemurianWhelpUtilityFamily", LemurianSurvivor.VoidRiftSkill);
			component.special = null;
			component.passiveSkill = new PassiveSkill
			{
				enabled = true,
				skillNameToken = "VOIDLEMURIAN_WHELP_PASSIVE_NAME",
				skillDescriptionToken = "VOIDLEMURIAN_WHELP_PASSIVE_DESCRIPTION",
				icon = VoidAssets.RebirthIcon
			};
		}

		private static void CreateWhelpSkin()
		{
			//IL_0041: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)WhelpBody.GetComponent<ModelLocator>().modelTransform).gameObject;
			SkinnedMeshRenderer[] meshes = Build.PrepareMeshes(gameObject, "RoR2/Base/Lemurian/skinLemurianBodyDefault_params.asset", VoidAssets.WhelpMaterial);
			SkinDef val = Build.Skin("WHELP", gameObject, meshes, VoidAssets.WhelpMaterial, new Color(0.09f, 0.03f, 0.18f), new Color(0.62f, 0.22f, 1f), new Color(0.24f, 0.08f, 0.42f), new Color(1f, 0.45f, 1f));
			gameObject.GetComponent<ModelSkinController>().skins = (SkinDef[])(object)new SkinDef[1] { val };
		}

		private static void CreateWhelpMaster()
		{
			WhelpMaster = PrefabAPI.InstantiateClone(Asset.Load<GameObject>("RoR2/Base/Lemurian/LemurianMaster.prefab"), "VoidLemurianWhelpMaster", true);
			WhelpMaster.GetComponent<CharacterMaster>().bodyPrefab = WhelpBody;
			Build.ClearDrivers(WhelpMaster);
			Build.Driver(WhelpMaster, "Bite", (SkillSlot)1, (TargetType)0, 0f, 6f, (MovementType)1, requireLoS: true);
			Build.Driver(WhelpMaster, "Spit", (SkillSlot)0, (TargetType)0, 0f, 35f, (MovementType)2, requireLoS: true);
			Build.Driver(WhelpMaster, "ReturnWhenFar", (SkillSlot)(-1), (TargetType)2, 50f, float.PositiveInfinity, (MovementType)1, requireLoS: false, sprint: true);
			Build.Driver(WhelpMaster, "Chase", (SkillSlot)(-1), (TargetType)0, 0f, 60f, (MovementType)1, requireLoS: false, sprint: true);
			Build.Driver(WhelpMaster, "ReturnToLeader", (SkillSlot)(-1), (TargetType)2, 12f, float.PositiveInfinity, (MovementType)1, requireLoS: false, sprint: true);
			Build.Driver(WhelpMaster, "Idle", (SkillSlot)(-1), (TargetType)2, 0f, float.PositiveInfinity, (MovementType)0);
			ContentAddition.AddMaster(WhelpMaster);
		}

		private static void CreateMirror()
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			MirrorBody = PrefabAPI.InstantiateClone(LemurianSurvivor.BodyPrefab, "VoidLemurianMirrorBody", true);
			CharacterBody component = MirrorBody.GetComponent<CharacterBody>();
			component.baseNameToken = "VOIDLEMURIAN_MIRROR_NAME";
			component.subtitleNameToken = "VOIDLEMURIAN_SUBTITLE";
			component.preferredPodPrefab = null;
			GameObject gameObject = ((Component)MirrorBody.GetComponent<ModelLocator>().modelTransform).gameObject;
			SkinnedMeshRenderer[] componentsInChildren = gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(true);
			RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length];
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				array[i] = Build.RendererInfo((Renderer)(object)componentsInChildren[i], VoidAssets.StarlessMaterial);
			}
			gameObject.GetComponent<CharacterModel>().baseRendererInfos = array;
			SkinDef val = Build.Skin("MIRROR", gameObject, componentsInChildren, VoidAssets.StarlessMaterial, new Color(0.02f, 0.02f, 0.04f), new Color(0.55f, 0.9f, 1f), new Color(0.13f, 0.15f, 0.25f), new Color(0.92f, 0.96f, 1f));
			gameObject.GetComponent<ModelSkinController>().skins = (SkinDef[])(object)new SkinDef[1] { val };
			ContentAddition.AddBody(MirrorBody);
			MirrorMaster = PrefabAPI.InstantiateClone(LemurianSurvivor.MasterPrefab, "VoidLemurianMirrorMaster", true);
			MirrorMaster.GetComponent<CharacterMaster>().bodyPrefab = MirrorBody;
			ContentAddition.AddMaster(MirrorMaster);
		}

		private static void OnCharacterDeath(DamageReport report)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Invalid comparison between Unknown and I4
			//IL_0019: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_009a: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00c8: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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)
			//IL_0114: 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_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			CharacterBody victimBody = report.victimBody;
			if (Object.op_Implicit((Object)(object)victimBody) && (int)victimBody.bodyIndex != -1 && victimBody.bodyIndex == MirrorBodyIndex)
			{
				CharacterBody val = ((Object.op_Implicit((Object)(object)report.victimMaster) && Object.op_Implicit((Object)(object)report.victimMaster.minionOwnership) && Object.op_Implicit((Object)(object)report.victimMaster.minionOwnership.ownerMaster)) ? report.victimMaster.minionOwnership.ownerMaster.GetBody() : null);
				CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val : victimBody);
				Vector3 corePosition = victimBody.corePosition;
				new BlastAttack
				{
					attacker = ((Component)val2).gameObject,
					inflictor = ((Component)victimBody).gameObject,
					teamIndex = (TeamIndex)((!Object.op_Implicit((Object)(object)victimBody.teamComponent)) ? 1 : ((int)victimBody.teamComponent.teamIndex)),
					position = corePosition,
					radius = 12f,
					baseDamage = val2.damage * 4f,
					baseForce = 800f,
					crit = val2.RollCrit(),
					damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)32768), (DamageTypeExtended)0, (DamageSource)4),
					damageColorIndex = (DamageColorIndex)9,
					falloffModel = (FalloffModel)0,
					procCoefficient = 1f,
					attackerFiltering = (AttackerFiltering)2
				}.Fire();
				EffectManager.SpawnEffect(VoidAssets.RiftExplosion, new EffectData
				{
					origin = corePosition,
					scale = 12f
				}, true);
			}
		}
	}
	internal static class Tokens
	{
		public const string Prefix = "VOIDLEMURIAN_";

		private const string GlideNote = " Hold <style=cIsUtility>Jump</style> while falling to <style=cIsUtility>glide</style>.";

		public static void Register()
		{
			Add("NAME", "Void Lemurian");
			Add("SUBTITLE", "Elder of the Abyss");
			Add("DESCRIPTION", "The Void Lemurian is an Elder Lemurian that wandered into the Void and came back wrong, hungry for anything that still has a shape.<color=#CCD3E0>\n\n< ! > Void Bolt homes in on enemies, so keep firing while you reposition.\n\n< ! > Null Breath roots whole packs in place. Follow it with Event Horizon to finish them together.\n\n< ! > Void Rift makes you untargetable and cleanses debuffs. Use it to escape or to dive into a crowd.\n\n< ! > Summons (whelps, mirrors, barnacles) fight for you, so Void Rebirth pairs well with them.\n\n< ! > Hold Jump while falling to glide. Look up during Void Rift to rise.</color>\n");
			Add("LORE", "The survey drone recorded only static, then a shape: an elder lemurian with scales the colour of a bruise and a mouth full of violet light.\n\nIt did not hunt like the others of Petrichor V. It waited for the planet to open a door, and walked through.\n\nWhatever it once was, the Void has finished with it. Now it is only hunger.");
			Add("OUTRO_FLAVOR", "..and so it left, the hunger of the Void sated for now.");
			Add("OUTRO_FAILURE", "..and so it vanished, swallowed by the abyss it once called home.");
			Add("LOADOUT_PASSIVE", "Passive");
			Add("SKIN_ABYSS_NAME", "Abyssal");
			Add("SKIN_STARLESS_NAME", "Starless");
			Add("SKIN_ELDER_NAME", "Elder");
			Add("SKIN_WHELP_NAME", "Whelp");
			Add("SKIN_MIRROR_NAME", "Mirror");
			Add("DEVOURINGABYSS_NAME", "Devouring Abyss");
			Add("DEVOURINGABYSS_DESCRIPTION", "Hits have a <style=cIsDamage>15%</style> chance to <style=cIsDamage>Collapse</style> enemies. Killing a Collapsed enemy <style=cIsHealing>heals 5% of your maximum health</style>. Hold <style=cIsUtility>Jump</style> while falling to <style=cIsUtility>glide</style>.");
			Add("VOIDREBIRTH_NAME", "Void Rebirth");
			Add("VOIDREBIRTH_DESCRIPTION", "<style=cIsHealing>Once per stage</style>, when you die you shed your body and rise again as a <style=cIsUtility>Void Whelp</style> with all your items. You become the Void Lemurian again on the next stage. Hold <style=cIsUtility>Jump</style> while falling to <style=cIsUtility>glide</style>.");
			Add("VOIDBOLT_NAME", "Void Bolt");
			Add("VOIDBOLT_DESCRIPTION", "Spit a <style=cIsUtility>homing</style> void bolt for <style=cIsDamage>260% damage</style>.");
			Add("VOIDBARRAGE_NAME", "Void Barrage");
			Add("VOIDBARRAGE_DESCRIPTION", "Spit a fan of <style=cIsDamage>3</style> void bolts for <style=cIsDamage>3x120% damage</style>.");
			Add("NULLBREATH_NAME", "Null Breath");
			Add("NULLBREATH_DESCRIPTION", "<style=cIsUtility>Nullifying</style>. Breathe a torrent of void flame that pierces enemies for <style=cIsDamage>1000% damage</style>.");
			Add("BROODCALL_NAME", "Brood Call");
			Add("BROODCALL_DESCRIPTION", "Call <style=cIsUtility>2 Void Whelps</style> out of the ground. They spit void bolts, bite, <style=cIsUtility>copy your items</style> and stay until killed. Recasting replaces them with fresh ones.");
			Add("VOIDRIFT_NAME", "Void Rift");
			Add("VOIDRIFT_DESCRIPTION", "Dissolve into the Void and <style=cIsUtility>rift forward</style>, becoming <style=cIsUtility>intangible</style> and <style=cIsUtility>cleansing all debuffs</style>. Emerge in a <style=cIsUtility>Nullifying</style> burst for <style=cIsDamage>400% damage</style>.");
			Add("VOIDMIRROR_NAME", "Void Mirror");
			Add("VOIDMIRROR_DESCRIPTION", "Split off a <style=cIsUtility>void clone</style> that <style=cIsUtility>copies your items</style> and fights for <style=cIsUtility>12 seconds</style>, then collapses in a <style=cIsUtility>Nullifying</style> burst for <style=cIsDamage>400% damage</style>. You turn <style=cIsUtility>invisible</style> for <style=cIsUtility>3 seconds</style>.");
			Add("EVENTHORIZON_NAME", "Event Horizon");
			Add("EVENTHORIZON_DESCRIPTION", "Launch a void orb for <style=cIsDamage>300% damage</style> that tears open a <style=cIsUtility>singularity</style>. It drags enemies in for <style=cIsDamage>9x50% damage</style>, then implodes for <style=cIsDamage>1000% damage</style> and <style=cIsDamage>Collapses</style> everything caught.");
			Add("BARNACLENEST_NAME", "Barnacle Nest");
			Add("BARNACLENEST_DESCRIPTION", "Plant <style=cIsUtility>2 Void Barnacles</style> where you aim. They shoot void bullets at enemies, <style=cIsUtility>copy your items</style> and stay until destroyed. Recasting moves them to the new spot.");
			Add("NULLDOMAIN_NAME", "Null Domain");
			Add("NULLDOMAIN_DESCRIPTION", "Open a huge void zone where you aim. Everything inside takes <style=cIsDamage>9x40% damage</style>, then the zone detonates for <style=cIsDamage>1000% damage</style> and <style=cIsHealth>instantly kills</style> non-boss enemies below <style=cIsHealth>30% health</style>.");
			Add("WHELP_NAME", "Void Whelp");
			Add("WHELP_SUBTITLE", "Spawn of the Abyss");
			Add("WHELP_PASSIVE_NAME", "What Remains");
			Add("WHELP_PASSIVE_DESCRIPTION", "All that's left after Void Rebirth. Survive to the next stage to regrow into the Void Lemurian. Hold <style=cIsUtility>Jump</style> while falling to <style=cIsUtility>glide</style>.");
			Add("WHELPSPIT_NAME", "Void Spit");
			Add("WHELPSPIT_DESCRIPTION", "Spit a <style=cIsUtility>homing</style> void bolt for <style=cIsDamage>200% damage</style>.");
			Add("WHELPBITE_NAME", "Void Bite");
			Add("WHELPBITE_DESCRIPTION", "Bite an enemy in front of you for <style=cIsDamage>" + VanillaBiteDamage() + " damage</style>.");
			Add("MIRROR_NAME", "Void Mirror");
			Add("KEYWORD_NULLIFY", "<style=cKeywordName>Nullifying</style><style=cSub>Each hit adds a stack of Nullify. At 3 stacks the enemy is <style=cIsUtility>rooted</style>.</style>");
			Add("KEYWORD_COLLAPSE", "<style=cKeywordName>Collapse</style><style=cSub>After 3 seconds, deal <style=cIsDamage>400%</style> base damage. Stacks.</style>");
		}

		private static string VanillaBiteDamage()
		{
			if (!float.TryParse(Asset.EscString("RoR2/Base/Lemurian/EntityStates.LemurianMonster.Bite.asset", "damageCoefficient"), NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
			{
				return "bite";
			}
			return (result * 100f).ToString("0", CultureInfo.InvariantCulture) + "%";
		}

		private static void Add(string key, string text)
		{
			LanguageAPI.Add("VOIDLEMURIAN_" + key, text);
		}
	}
	internal static class VoidAssets
	{
		private const string FlamebreathEsc = "RoR2/Base/LemurianBruiser/EntityStates.LemurianBruiserMonster.Flamebreath.asset";

		private const string BlinkEsc = "RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.VoidBlinkBase+VoidBlinkUp.asset";

		private const string BlasterSmallEsc = "RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.Weapon.FireMegaBlasterSmall.asset";

		private const string BlasterBigEsc = "RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.Weapon.FireMegaBlasterBig.asset";

		private const string ChargeBlasterEsc = "RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.Weapon.ChargeMegaBlaster.asset";

		private static readonly Color[] AbyssPalette = (Color[])(object)new Color[5]
		{
			new Color(0.02f, 0.01f, 0.04f),
			new Color(0.09f, 0.03f, 0.18f),
			new Color(0.24f, 0.08f, 0.42f),
			new Color(0.52f, 0.24f, 0.8f),
			new Color(0.93f, 0.78f, 1f)
		};

		private static readonly Color[] StarlessPalette = (Color[])(object)new Color[5]
		{
			new Color(0.01f, 0.01f, 0.02f),
			new Color(0.04f, 0.05f, 0.09f),
			new Color(0.13f, 0.15f, 0.25f),
			new Color(0.42f, 0.48f, 0.68f),
			new Color(0.92f, 0.96f, 1f)
		};

		public static readonly Color VoidPurple = new Color(0.62f, 0.22f, 1f);

		public static Material AbyssMaterial;

		public static Material StarlessMaterial;

		public static Material ElderMaterial;

		public static Material WhelpMaterial;

		public static Texture2D Portrait;

		public static Texture2D WhelpPortrait;

		public static Sprite PassiveIcon;

		public static Sprite RebirthIcon;

		public static Sprite PrimaryIcon;

		public static Sprite BarrageIcon;

		public static Sprite SecondaryIcon;

		public static Sprite BroodIcon;

		public static Sprite UtilityIcon;

		public static Sprite MirrorIcon;

		public static Sprite SpecialIcon;

		public static Sprite BarnacleIcon;

		public static Sprite NullDomainIcon;

		public static Sprite BiteIcon;

		public static GameObject SurvivorPod;

		public static GameObject BarnacleAllyMaster;

		public static GameObject RezEffect;

		public static string BroodSound;

		public static GameObject BreathEffect;

		public static GameObject BreathImpact;

		public static GameObject BlinkVfx;

		public static GameObject BlinkMuzzleflash;

		public static Material BlinkOverlay;

		public static GameObject RiftExplosion;

		public static GameObject BoltMuzzleflash;

		public static GameObject HorizonMuzzleflash;

		public static GameObject HorizonCharge;

		public static GameObject ImplodeEffect;

		public static string BreathStartSound;

		public static string BreathEndSound;

		public static string BlinkStartSound;

		public static string BlinkEndSound;

		public static string BoltSound;

		public static string HorizonChargeSound;

		public static string HorizonFireSound;

		public static void Init()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			Material source = (ElderMaterial = Asset.Load<Material>("RoR2/Base/Lemurian/matLemurianBruiser.mat"));
			AbyssMaterial = MakeBodyMaterial(source, "matVoidLemurianAbyss", AbyssPalette, new Color(1.1f, 0.3f, 1.6f), Asset.Load<Texture>("RoR2/Base/Common/ColorRamps/texRampNullifier.png"));
			StarlessMaterial = MakeBodyMaterial(source, "matVoidLemurianStarless", StarlessPalette, new Color(0.55f, 1.1f, 1.6f), Asset.Load<Texture>("RoR2/DLC1/Common/ColorRamps/texRampVoidArenaShield.png"));
			Portrait = GradientMap(Asset.Load<Texture>("RoR2/Base/LemurianBruiser/LemurianBruiserBody.png"), AbyssPalette, 1.1f, mipChain: false);
			((Object)Portrait).name = "texVoidLemurianIcon";
			WhelpMaterial = MakeBodyMaterial(Asset.Load<Material>("RoR2/Base/Lemurian/matLemurian.mat"), "matVoidLemurianWhelp", AbyssPalette, new Color(1.1f, 0.3f, 1.6f), Asset.Load<Texture>("RoR2/Base/Common/ColorRamps/texRampNullifier.png"));
			WhelpPortrait = GradientMap(Asset.Load<Texture>("RoR2/Base/Lemurian/LemurianBody.png"), AbyssPalette, 1.1f, mipChain: false);
			((Object)WhelpPortrait).name = "texVoidLemurianWhelpIcon";
			PrimaryIcon = SkillIcon("RoR2/DLC1/VoidSurvivor/ChargeMegaBlaster.asset");
			SecondaryIcon = SkillIcon("RoR2/DLC1/VoidSurvivor/FireHandBeam.asset");
			UtilityIcon = SkillIcon("RoR2/DLC1/VoidSurvivor/VoidBlinkUp.asset");
			SpecialIcon = SkillIcon("RoR2/DLC1/VoidSurvivor/FireCorruptDisk.asset");
			PassiveIcon = SkillIcon("RoR2/DLC1/VoidSurvivor/VoidSurvivorPassive.asset");
			NullDomainIcon = SkillIcon("RoR2/DLC1/VoidSurvivor/CrushCorruption.asset");
			BiteIcon = SkillIcon("RoR2/DLC1/VoidSurvivor/SwingMelee.asset");
			RebirthIcon = IconFromTexture(Asset.Load<Texture>("RoR2/DLC1/ExtraLifeVoid/texHippoVoidIcon.png"));
			BroodIcon = IconFromTexture((Texture)(object)WhelpPortrait);
			BarrageIcon = VoidTint(SkillIcon("RoR2/Base/Mage/MageBodyFireFirebolt.asset"));
			BarnacleIcon = VoidTint(SkillIcon("RoR2/Base/Engi/EngiBodyPlaceTurret.asset"));
			MirrorIcon = VoidTint(IconFromTexture(Asset.Load<Texture>("RoR2/Base/GhostOnKill/texMaskIcon.png")));
			SurvivorPod = Asset.Load<GameObject>("RoR2/DLC1/VoidSurvivor/VoidSurvivorPod.prefab");
			BarnacleAllyMaster = Asset.Load<GameObject>("RoR2/DLC1/VoidBarnacle/VoidBarnacleAllyMaster.prefab");
			RezEffect = Asset.Load<GameObject>("RoR2/DLC1/ExtraLifeVoid/VoidRezEffect.prefab");
			BroodSound = Asset.EscString("RoR2/Base/LemurianBruiser/EntityStates.LemurianBruiserMonster.SpawnState.asset", "spawnSoundString");
			BreathEffect = ScalableClone(Asset.EscObject<GameObject>("RoR2/Base/LemurianBruiser/EntityStates.LemurianBruiserMonster.Flamebreath.asset", "flamethrowerEffectPrefab"), "VoidLemurianBreathEffect");
			Recolor(BreathEffect, Asset.Load<Texture>("RoR2/Base/Common/ColorRamps/texRampNullifier.png"), VoidPurple, new Color(0.85f, 0.55f, 1f));
			BreathImpact = Asset.Load<GameObject>("RoR2/DLC1/VoidSurvivor/VoidSurvivorBeamImpact.prefab");
			BreathStartSound = Asset.EscString("RoR2/Base/LemurianBruiser/EntityStates.LemurianBruiserMonster.Flamebreath.asset", "startAttackSoundString");
			BreathEndSound = Asset.EscString("RoR2/Base/LemurianBruiser/EntityStates.LemurianBruiserMonster.Flamebreath.asset", "endAttackSoundString");
			BlinkVfx = Asset.EscObject<GameObject>("RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.VoidBlinkBase+VoidBlinkUp.asset", "blinkVfxPrefab");
			BlinkMuzzleflash = Asset.EscObject<GameObject>("RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.VoidBlinkBase+VoidBlinkUp.asset", "blinkEffectPrefab");
			BlinkOverlay = Asset.EscObject<Material>("RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.VoidBlinkBase+VoidBlinkUp.asset", "overlayMaterial");
			BlinkStartSound = Asset.EscString("RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.VoidBlinkBase+VoidBlinkUp.asset", "beginSoundString");
			BlinkEndSound = Asset.EscString("RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.VoidBlinkBase+VoidBlinkUp.asset", "endSoundString");
			RiftExplosion = Asset.Load<GameObject>("RoR2/DLC1/VoidSurvivor/VoidSurvivorMegaBlasterExplosion.prefab");
			BoltMuzzleflash = Asset.EscObject<GameObject>("RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.Weapon.FireMegaBlasterSmall.asset", "muzzleflashEffectPrefab");
			BoltSound = Asset.EscString("RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.Weapon.FireMegaBlasterSmall.asset", "attackSoundString");
			HorizonCharge = ScalableClone(Asset.EscObject<GameObject>("RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.Weapon.ChargeMegaBlaster.asset", "chargeEffectPrefab"), "VoidLemurianHorizonCharge");
			HorizonChargeSound = Asset.EscString("RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.Weapon.ChargeMegaBlaster.asset", "chargeSoundString");
			HorizonMuzzleflash = Asset.EscObject<GameObject>("RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.Weapon.FireMegaBlasterBig.asset", "muzzleflashEffectPrefab");
			HorizonFireSound = Asset.EscString("RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.Weapon.FireMegaBlasterBig.asset", "attackSoundString");
			ImplodeEffect = Asset.Load<GameObject>("RoR2/DLC1/ElementalRingVoid/ElementalRingVoidImplodeEffect.prefab");
		}

		private static GameObject ScalableClone(GameObject prefab, string name)
		{
			//IL_0018: 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)
			GameObject val = PrefabAPI.InstantiateClone(prefab, name, false);
			ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				MainModule main = componentsInChildren[i].main;
				((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0;
			}
			return val;
		}

		private static Sprite SkillIcon(string skillDefKey)
		{
			SkillDef val = Asset.Load<SkillDef>(skillDefKey);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			return val.icon;
		}

		private static Sprite IconFromTexture(Texture texture)
		{
			//IL_002a: 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)
			Texture2D val = (Texture2D)(object)((texture is Texture2D) ? texture : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}

		private static Sprite VoidTint(Sprite source)
		{
			if (!Object.op_Implicit((Object)(object)source))
			{
				return null;
			}
			try
			{
				return VoidTintUnchecked(source);
			}
			catch (Exception ex)
			{
				VoidLemurianPlugin.Log.LogWarning((object)("Could not recolour icon " + ((Object)source).name + ", using it as is: " + ex.Message));
				return source;
			}
		}

		private static Sprite VoidTintUnchecked(Sprite source)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			//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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			if (source.packed && (int)source.packingMode == 0)
			{
				return source;
			}
			Rect textureRect = source.textureRect;
			Texture2D obj = ReadableCopy((Texture)(object)source.texture, mipChain: false);
			int num = Mathf.RoundToInt(((Rect)(ref textureRect)).x);
			int num2 = Mathf.RoundToInt(((Rect)(ref textureRect)).y);
			int num3 = Mathf.RoundToInt(((Rect)(ref textureRect)).width);
			int num4 = Mathf.RoundToInt(((Rect)(ref textureRect)).height);
			Color[] pixels = obj.GetPixels(num, num2, num3, num4);
			Object.Destroy((Object)(object)obj);
			float num5 = default(float);
			float num6 = default(float);
			float num7 = default(float);
			for (int i = 0; i < pixels.Length; i++)
			{
				Color.RGBToHSV(pixels[i], ref num5, ref num6, ref num7);
				if (num6 > 0.1f)
				{
					num5 = 0.79f;
				}
				Color val = Color.HSVToRGB(num5, num6, num7);
				val.a = pixels[i].a;
				pixels[i] = val;
			}
			Texture2D val2 = new Texture2D(num3, num4, (TextureFormat)4, false);
			val2.SetPixels(pixels);
			val2.Apply(false, true);
			return Sprite.Create(val2, new Rect(0f, 0f, (float)num3, (float)num4), new Vector2(0.5f, 0.5f));
		}

		private static Material MakeBodyMaterial(Material source, string name, Color[] palette, Color emission, Texture fresnelRamp)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(source)
			{
				name = name
			};
			val.SetTexture("_MainTex", (Texture)(object)GradientMap(source.GetTexture("_MainTex"), palette, 1.5f, mipChain: true));
			Texture texture = source.GetTexture("_EmTex");
			if (Object.op_Implicit((Object)(object)texture))
			{
				val.SetTexture("_EmTex", (Texture)(object)Grayscale(texture));
			}
			val.SetColor("_EmColor", emission);
			val.SetFloat("_EmPower", 2.2f);
			val.SetColor("_Color", Color.white);
			if (Object.op_Implicit((Object)(object)fresnelRamp))
			{
				val.SetTexture("_FresnelRamp", fresnelRamp);
				val.SetFloat("_FEON", 1f);
				val.EnableKeyword("FRESNEL_EMISSION");
				val.SetFloat("_FresnelPower", 1.6f);
				val.SetFloat("_FresnelBoost", 2f);
			}
			return val;
		}

		private static Texture2D ReadableCopy(Texture source, bool mipChain)
		{
			//IL_0037: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			RenderTexture temporary = RenderTexture.GetTemporary(source.width, source.height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2);
			Graphics.Blit(source, temporary);
			RenderTexture active = RenderTexture.active;
			RenderTexture.active = temporary;
			Texture2D val = new Texture2D(source.width, source.height, (TextureFormat)4, mipChain, false);
			val.ReadPixels(new Rect(0f, 0f, (float)source.width, (float)source.height), 0, 0);
			RenderTexture.active = active;
			RenderTexture.ReleaseTemporary(temporary);
			return val;
		}

		private static Texture2D GradientMap(Texture source, Color[] palette, float contrast, bool mipChain)
		{
			//IL_0018: 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_0023: 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)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_009c: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = ReadableCopy(source, mipChain);
			Color32[] pixels = val.GetPixels32();
			for (int i = 0; i < pixels.Length; i++)
			{
				Color32 val2 = pixels[i];
				float num = (0.299f * (float)(int)val2.r + 0.587f * (float)(int)val2.g + 0.114f * (float)(int)val2.b) / 255f;
				num = Mathf.Clamp01((num - 0.4f) * contrast + 0.4f);
				Color val3 = SamplePalette(palette, num);
				pixels[i] = new Color32((byte)(val3.r * 255f), (byte)(val3.g * 255f), (byte)(val3.b * 255f), val2.a);
			}
			val.SetPixels32(pixels);
			val.Apply(mipChain, false);
			((Texture)val).wrapMode = source.wrapMode;
			return val;
		}

		private static Texture2D Grayscale(Texture source)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = ReadableCopy(source, mipChain: true);
			Color32[] pixels = val.GetPixels32();
			for (int i = 0; i < pixels.Length; i++)
			{
				Color32 val2 = pixels[i];
				byte b = (byte)Mathf.Max((int)val2.r, Mathf.Max((int)val2.g, (int)val2.b));
				pixels[i] = new Color32(b, b, b, val2.a);
			}
			val.SetPixels32(pixels);
			val.Apply(true, true);
			return val;
		}

		private static Color SamplePalette(Color[] palette, float t)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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)
			float num = t * (float)(palette.Length - 1);
			int num2 = Mathf.Min((int)num, palette.Length - 2);
			return Color.Lerp(palette[num2], palette[num2 + 1], num - (float)num2);
		}

		public static void Recolor(GameObject root, Texture ramp, Color tint, Color remapTint)
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Invalid comparison between Unknown and I4
			//IL_00e4: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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_011d: 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)
			Dictionary<Material, Material> dictionary = new Dictionary<Material, Material>();
			Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val in componentsInChildren)
			{
				Material[] sharedMaterials = val.sharedMaterials;
				for (int j = 0; j < sharedMaterials.Length; j++)
				{
					Material val2 = sharedMaterials[j];
					if (Object.op_Implicit((Object)(object)val2))
					{
						if (!dictionary.TryGetValue(val2, out var value))
						{
							value = (dictionary[val2] = RecolorMaterial(val2, ramp, tint, remapTint));
						}
						sharedMaterials[j] = value;
					}
				}
				val.sharedMaterials = sharedMaterials;
			}
			ParticleSystem[] componentsInChildren2 = root.GetComponentsInChildren<ParticleSystem>(true);
			foreach (ParticleSystem val4 in componentsInChildren2)
			{
				ParticleSystemRenderer component = ((Component)val4).GetComponent<ParticleSystemRenderer>();
				if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)((Renderer)component).sharedMaterial) || !((Renderer)component).sharedMaterial.HasProperty("_RemapTex"))
				{
					MainModule main = val4.main;
					MinMaxGradient startColor = ((MainModule)(ref main)).startColor;
					if ((int)((MinMaxGradient)(ref startColor)).mode == 0)
					{
						((MinMaxGradient)(ref startColor)).color = Retint(((MinMaxGradient)(ref startColor)).color, tint);
					}
					else if ((int)((MinMaxGradient)(ref startColor)).mode == 2)
					{
						((MinMaxGradient)(ref startColor)).colorMin = Retint(((MinMaxGradient)(ref startColor)).colorMin, tint);
						((MinMaxGradient)(ref startColor)).colorMax = Retint(((MinMaxGradient)(ref startColor)).colorMax, tint);
					}
					((MainModule)(ref main)).startColor = startColor;
				}
			}
			Light[] componentsInChildren3 = root.GetComponentsInChildren<Light>(true);
			for (int i = 0; i < componentsInChildren3.Length; i++)
			{
				componentsInChildren3[i].color = tint;
			}
		}

		private static Material RecolorMaterial(Material material, Texture ramp, Color tint, Color remapTint)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_006a: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)material.shader).name.Contains("Distortion"))
			{
				return material;
			}
			Material val = new Material(material)
			{
				name = ((Object)material).name + "VoidLemurian"
			};
			if (Object.op_Implicit((Object)(object)ramp) && val.HasProperty("_RemapTex"))
			{
				val.SetTexture("_RemapTex", ramp);
				if (val.HasProperty("_TintColor"))
				{
					Color color = val.GetColor("_TintColor");
					val.SetColor("_TintColor", new Color(color.r * remapTint.r, color.g * remapTint.g, color.b * remapTint.b, color.a));
				}
				return val;
			}
			string[] array = new string[2] { "_TintColor", "_Color" };
			foreach (string text in array)
			{
				if (val.HasProperty(text) && IsColorful(val.GetColor(text)))
				{
					val.SetColor(text, Retint(val.GetColor(text), tint));
				}
			}
			return val;
		}

		private static bool IsColorful(Color c)
		{
			//IL_0008: 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_001a: 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_0037: