Decompiled source of NewtsGrasp v1.0.0

NewtEquip.dll

Decompiled 7 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.NewtMonster;
using IL.RoR2;
using KinematicCharacterController;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using R2API;
using R2API.Utils;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering.PostProcessing;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("NewtEquip")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NewtEquip")]
[assembly: AssemblyTitle("NewtEquip")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace NewtEquip;

internal class Assets
{
	public static AssetBundle MainAssetBundle;

	public static T Load<T>(string name) where T : Object
	{
		return MainAssetBundle.LoadAsset<T>(name);
	}

	public static void PopulateAssets()
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		if ((Object)(object)MainAssetBundle == (Object)null)
		{
			using (Stream stream = executingAssembly.GetManifestResourceStream("NewtEquip.AssetBundle.newtassets"))
			{
				MainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
		}
	}
}
internal class TimeStopInflicted : MonoBehaviour
{
}
internal class TimeStopBehaviour : NetworkBehaviour
{
	public bool active = true;

	[SyncVar]
	public float stopDuration = MainPlugin.duration.Value;

	public GameObject owner;

	private float stopwatch;

	private TeamMask mask;

	private List<CharacterBody> bodies = new List<CharacterBody>();

	private List<Animator> animators = new List<Animator>();

	private List<ParticleSystem> particles = new List<ParticleSystem>();

	private List<ProjectileController> projectiles = new List<ProjectileController>();

	private void OnEnable()
	{
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Expected O, but got Unknown
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Expected O, but got Unknown
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Expected O, but got Unknown
		foreach (TimeStopBehaviour instances in InstanceTracker.GetInstancesList<TimeStopBehaviour>())
		{
			instances.stopDuration += stopDuration;
			active = false;
		}
		if (active)
		{
			InstanceTracker.Add<TimeStopBehaviour>(this);
			MusicController.LateUpdate += new Manipulator(MusicController_LateUpdate);
			Run.ShouldUpdateRunStopwatch += new hook_ShouldUpdateRunStopwatch(Run_ShouldUpdateRunStopwatch);
			CombatDirector.FixedUpdate += new hook_FixedUpdate(CombatDirector_FixedUpdate);
		}
		else
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}

	private void CombatDirector_FixedUpdate(orig_FixedUpdate orig, CombatDirector self)
	{
	}

	private bool Run_ShouldUpdateRunStopwatch(orig_ShouldUpdateRunStopwatch orig, Run self)
	{
		return false;
	}

	private void OnDisable()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		if (active)
		{
			InstanceTracker.Remove<TimeStopBehaviour>(this);
			MusicController.LateUpdate -= new Manipulator(MusicController_LateUpdate);
			Run.ShouldUpdateRunStopwatch -= new hook_ShouldUpdateRunStopwatch(Run_ShouldUpdateRunStopwatch);
			CombatDirector.FixedUpdate -= new hook_FixedUpdate(CombatDirector_FixedUpdate);
		}
	}

	private void MusicController_LateUpdate(ILContext il)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		ILCursor val = new ILCursor(il);
		int num = default(int);
		val.GotoNext(new Func<Instruction, bool>[1]
		{
			(Instruction i) => ILPatternMatchingExt.MatchStloc(i, ref num)
		});
		val.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)((bool b) => true));
	}

	private void Start()
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0300: Unknown result type (might be due to invalid IL or missing references)
		//IL_0312: Unknown result type (might be due to invalid IL or missing references)
		//IL_0317: Unknown result type (might be due to invalid IL or missing references)
		//IL_0323: Unknown result type (might be due to invalid IL or missing references)
		//IL_0328: Unknown result type (might be due to invalid IL or missing references)
		//IL_0366: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d5: Expected O, but got Unknown
		if (!active)
		{
			return;
		}
		AkSoundEngine.PostEvent(KickFromShop.stompSoundString, owner);
		mask = TeamMask.GetEnemyTeams(owner.GetComponent<TeamComponent>().teamIndex);
		((Behaviour)((Component)this).GetComponent<OutsideInteractableLocker>()).enabled = true;
		List<ProjectileController> instancesList = InstanceTracker.GetInstancesList<ProjectileController>();
		foreach (ProjectileController item in instancesList)
		{
			if (item.cannotBeDeleted || !((TeamMask)(ref mask)).HasTeam(item.teamFilter.teamIndex))
			{
				continue;
			}
			projectiles.Add(item);
			ProjectileGhostController ghost = item.ghost;
			if (Object.op_Implicit((Object)(object)ghost))
			{
				ParticleSystem[] componentsInChildren = ((Component)ghost).GetComponentsInChildren<ParticleSystem>();
				foreach (ParticleSystem val in componentsInChildren)
				{
					particles.Add(val);
					val.Pause();
				}
			}
			Rigidbody component = ((Component)item).GetComponent<Rigidbody>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.velocity = Vector3.zero;
			}
			ProjectileSimple component2 = ((Component)item).GetComponent<ProjectileSimple>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				((Behaviour)component2).enabled = false;
			}
			MissileController component3 = ((Component)item).GetComponent<MissileController>();
			if (Object.op_Implicit((Object)(object)component3))
			{
				((Behaviour)component3).enabled = false;
			}
			ProjectileSteerTowardTarget component4 = ((Component)item).GetComponent<ProjectileSteerTowardTarget>();
			if (Object.op_Implicit((Object)(object)component4))
			{
				((Behaviour)component4).enabled = false;
			}
			ProjectileCharacterController component5 = ((Component)item).GetComponent<ProjectileCharacterController>();
			if (Object.op_Implicit((Object)(object)component5))
			{
				((Behaviour)component5).enabled = false;
			}
			ProjectileImpactExplosion component6 = ((Component)item).GetComponent<ProjectileImpactExplosion>();
			if (Object.op_Implicit((Object)(object)component6))
			{
				((Behaviour)component6).enabled = false;
			}
			ProjectileDirectionalTargetFinder component7 = ((Component)item).GetComponent<ProjectileDirectionalTargetFinder>();
			if (Object.op_Implicit((Object)(object)component7))
			{
				((Behaviour)component7).enabled = false;
			}
			ProjectileSphereTargetFinder component8 = ((Component)item).GetComponent<ProjectileSphereTargetFinder>();
			if (Object.op_Implicit((Object)(object)component8))
			{
				((Behaviour)component7).enabled = false;
			}
			ProjectileTargetComponent component9 = ((Component)item).GetComponent<ProjectileTargetComponent>();
			if (Object.op_Implicit((Object)(object)component9))
			{
				component9.target = null;
			}
		}
		foreach (CharacterBody instances in CharacterBody.instancesList)
		{
			if (!((TeamMask)(ref mask)).HasTeam(instances.teamComponent.teamIndex) || !instances.healthComponent.alive || !Object.op_Implicit((Object)(object)instances.master) || Object.op_Implicit((Object)(object)((Component)instances).GetComponent<TimeStopInflicted>()))
			{
				continue;
			}
			((Component)instances).gameObject.AddComponent<TimeStopInflicted>();
			bodies.Add(instances);
			RigidbodyMotor component10 = ((Component)instances).GetComponent<RigidbodyMotor>();
			if (Object.op_Implicit((Object)(object)instances.characterMotor) && !instances.characterMotor.isGrounded)
			{
				((BaseCharacterController)instances.characterMotor).Motor.AttachedRigidbody.velocity = Vector3.zero;
				instances.characterMotor.velocity = Vector3.zero;
				instances.characterMotor.rootMotion = Vector3.zero;
				instances.characterMotor.useGravity = false;
				((Behaviour)((BaseCharacterController)instances.characterMotor).Motor).enabled = false;
			}
			else if (Object.op_Implicit((Object)(object)component10))
			{
				component10.rigid.velocity = Vector3.zero;
				component10.rootMotion = Vector3.zero;
				((Behaviour)component10).enabled = false;
			}
			if (Util.HasEffectiveAuthority(((Component)instances).gameObject))
			{
				EntityStateMachine[] components = ((Component)instances).GetComponents<EntityStateMachine>();
				foreach (EntityStateMachine val2 in components)
				{
					if (val2.customName == "Body")
					{
						val2.SetNextState((EntityState)new BaseState());
					}
					else
					{
						val2.SetNextStateToMain();
					}
				}
			}
			if (Object.op_Implicit((Object)(object)instances.modelLocator) && Object.op_Implicit((Object)(object)instances.modelLocator.modelTransform))
			{
				ParticleSystem[] componentsInChildren2 = ((Component)instances.modelLocator.modelTransform).GetComponentsInChildren<ParticleSystem>();
				foreach (ParticleSystem val3 in componentsInChildren2)
				{
					val3.Pause();
					particles.Add(val3);
				}
				Animator component11 = ((Component)instances.modelLocator.modelTransform).GetComponent<Animator>();
				if (Object.op_Implicit((Object)(object)component11))
				{
					component11.speed = 0f;
					animators.Add(component11);
				}
			}
		}
	}

	private void FixedUpdate()
	{
		if (Object.op_Implicit((Object)(object)Run.instance))
		{
			Run.instance.SetRunStopwatch(Run.instance.GetRunStopwatch() + MainPlugin.difficultySpeed.Value * Time.fixedDeltaTime);
		}
		stopwatch += Time.fixedDeltaTime;
		if (stopwatch >= stopDuration)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}

	private void OnDestroy()
	{
		AkSoundEngine.PostEvent(KickFromShop.stompSoundString, Object.op_Implicit((Object)(object)owner) ? owner : ((Component)this).gameObject);
		((Behaviour)((Component)this).GetComponent<OutsideInteractableLocker>()).enabled = false;
		foreach (ProjectileController projectile in projectiles)
		{
			if (Object.op_Implicit((Object)(object)projectile))
			{
				ProjectileSimple component = ((Component)projectile).GetComponent<ProjectileSimple>();
				if (Object.op_Implicit((Object)(object)component))
				{
					((Behaviour)component).enabled = true;
					component.SetForwardSpeed(component.desiredForwardSpeed);
				}
				MissileController component2 = ((Component)projectile).GetComponent<MissileController>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					((Behaviour)component2).enabled = true;
				}
				ProjectileSteerTowardTarget component3 = ((Component)projectile).GetComponent<ProjectileSteerTowardTarget>();
				if (Object.op_Implicit((Object)(object)component3))
				{
					((Behaviour)component3).enabled = true;
				}
				ProjectileCharacterController component4 = ((Component)projectile).GetComponent<ProjectileCharacterController>();
				if (Object.op_Implicit((Object)(object)component4))
				{
					((Behaviour)component4).enabled = true;
				}
				ProjectileImpactExplosion component5 = ((Component)projectile).GetComponent<ProjectileImpactExplosion>();
				if (Object.op_Implicit((Object)(object)component5))
				{
					((Behaviour)component5).enabled = true;
				}
				ProjectileDirectionalTargetFinder component6 = ((Component)projectile).GetComponent<ProjectileDirectionalTargetFinder>();
				if (Object.op_Implicit((Object)(object)component6))
				{
					((Behaviour)component6).enabled = true;
				}
				ProjectileSphereTargetFinder component7 = ((Component)projectile).GetComponent<ProjectileSphereTargetFinder>();
				if (Object.op_Implicit((Object)(object)component7))
				{
					((Behaviour)component6).enabled = true;
				}
			}
		}
		foreach (ParticleSystem particle in particles)
		{
			if (Object.op_Implicit((Object)(object)particle))
			{
				particle.Play();
			}
		}
		foreach (CharacterBody body in bodies)
		{
			if (Object.op_Implicit((Object)(object)body))
			{
				Object.Destroy((Object)(object)((Component)body).gameObject.GetComponent<TimeStopInflicted>());
				RigidbodyMotor component8 = ((Component)body).GetComponent<RigidbodyMotor>();
				if (Object.op_Implicit((Object)(object)body.characterMotor) && !body.characterMotor.isGrounded)
				{
					((Behaviour)((BaseCharacterController)body.characterMotor).Motor).enabled = true;
					body.characterMotor.useGravity = true;
				}
				else if (Object.op_Implicit((Object)(object)component8))
				{
					((Behaviour)component8).enabled = true;
				}
				if (Util.HasEffectiveAuthority(((Component)body).gameObject))
				{
					((Component)body).GetComponent<EntityStateMachine>().SetNextStateToMain();
				}
				Object.Destroy((Object)(object)((Component)body).GetComponent<TimeStopInflicted>());
			}
		}
		foreach (Animator animator in animators)
		{
			if (Object.op_Implicit((Object)(object)animator))
			{
				animator.speed = 1f;
			}
		}
	}
}
internal class DeathState : GenericCharacterDeath
{
	public override void OnEnter()
	{
		//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)
		((GenericCharacterDeath)this).OnEnter();
		AkSoundEngine.PostEvent(KickFromShop.stompSoundString, ((EntityState)this).gameObject);
		EffectManager.SimpleEffect(Prefabs.Load<GameObject>("RoR2/Base/Shopkeeper/ShopkeeperKickFromShopExplosion.prefab"), ((EntityState)this).characterBody.corePosition, Quaternion.identity, false);
		if (NetworkServer.active)
		{
			((GenericCharacterDeath)this).OnPreDestroyBodyServer();
			EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
		}
	}
}
internal class Hook
{
	internal static void Hooks()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(EquipmentSlot_PerformEquipmentAction);
	}

	private static bool EquipmentSlot_PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
	{
		//IL_0017: 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_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_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)equipmentDef == (Object)(object)Prefabs.newtEquip)
		{
			Vector3 corePosition = self.characterBody.corePosition;
			EffectManager.SimpleEffect(Prefabs.procEffect, corePosition, Quaternion.identity, true);
			GameObject val = Object.Instantiate<GameObject>(Prefabs.timeStopper, corePosition, Quaternion.identity);
			val.GetComponent<TimeStopBehaviour>().owner = ((Component)self.characterBody).gameObject;
			NetworkServer.Spawn(val);
			return true;
		}
		return orig.Invoke(self, equipmentDef);
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Dragonyck.NewtEquip", "NewtEquip", "1.0.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class MainPlugin : BaseUnityPlugin
{
	public const string MODUID = "com.Dragonyck.NewtEquip";

	public const string MODNAME = "NewtEquip";

	public const string VERSION = "1.0.0";

	internal static ConfigEntry<float> cooldown;

	internal static ConfigEntry<float> duration;

	internal static ConfigEntry<float> difficultySpeed;

	private void Awake()
	{
		cooldown = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Cooldown", 25f, (ConfigDescription)null);
		duration = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Duration", 6f, (ConfigDescription)null);
		difficultySpeed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Difficulty Speed Mult", 3f, (ConfigDescription)null);
		Assets.PopulateAssets();
		Prefabs.CreatePrefabs();
		Hook.Hooks();
	}
}
internal class Prefabs
{
	internal static EquipmentDef newtEquip;

	internal static GameObject procEffect;

	internal static GameObject timeStopper;

	internal static T Load<T>(string path)
	{
		//IL_0002: 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)
		return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
	}

	internal static GameObject Instantiate(string path, string name, bool registerNetwork = false)
	{
		return PrefabAPI.InstantiateClone(Load<GameObject>(path), name, registerNetwork);
	}

	internal static GameObject Instantiate(GameObject obj, string name, bool registerNetwork = false)
	{
		return PrefabAPI.InstantiateClone(obj, name, registerNetwork);
	}

	internal static void CreatePrefabs()
	{
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Expected O, but got Unknown
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c1: Expected O, but got Unknown
		//IL_0390: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
		LanguageAPI.Add("NEWTEQUIP_NAME", "Newts Grasp");
		LanguageAPI.Add("NEWTEQUIP_DESC", "<style=cIsUtility>Freezes time</style> for <style=cIsUtility>" + MainPlugin.duration.Value + "s</style>, and the difficulty scales <style=cIsHealth>" + MainPlugin.difficultySpeed.Value * 100f + "%</style> faster.");
		LanguageAPI.Add("NEWTEQUIP_PICKUP", "<style=cIsUtility>Freezes time</style>, but <style=cIsHealth>difficulty rises</style>.");
		LanguageAPI.Add("NEWTEQUIP_LORE", "");
		newtEquip = ScriptableObject.CreateInstance<EquipmentDef>();
		((Object)newtEquip).name = "NewtEquip";
		newtEquip.nameToken = "NEWTEQUIP_NAME";
		newtEquip.descriptionToken = "NEWTEQUIP_DESC";
		newtEquip.pickupToken = "NEWTEQUIP_PICKUP";
		newtEquip.loreToken = "NEWTEQUIP_LORE";
		newtEquip.canDrop = false;
		newtEquip.cooldown = MainPlugin.cooldown.Value;
		newtEquip.isLunar = true;
		newtEquip.pickupIconSprite = Assets.Load<Sprite>("icon");
		newtEquip.pickupModelPrefab = Instantiate(Assets.Load<GameObject>("HandMdl"), "NewtsHandPickupMdl");
		((Renderer)newtEquip.pickupModelPrefab.GetComponentInChildren<MeshRenderer>()).material = Load<Material>("RoR2/Base/Shopkeeper/matNewt.mat");
		ContentAddition.AddEquipmentDef(newtEquip);
		procEffect = Instantiate("RoR2/DLC1/FragileDamageBonus/DelicateWatchProcEffect.prefab", "ProcEffect");
		ParticleSystemRenderer[] componentsInChildren = procEffect.GetComponentsInChildren<ParticleSystemRenderer>();
		foreach (ParticleSystemRenderer val in componentsInChildren)
		{
			((Renderer)val).material = new Material(((Renderer)val).material);
			((Renderer)val).material.DisableKeyword("VERTEXCOLOR");
			((Renderer)val).material.SetColor("_TintColor", Color32.op_Implicit(new Color32((byte)11, (byte)40, (byte)176, byte.MaxValue)));
		}
		ContentAddition.AddEffect(procEffect);
		ExplicitPickupDropTable val2 = ScriptableObject.CreateInstance<ExplicitPickupDropTable>();
		((PickupDropTable)val2).canDropBeReplaced = false;
		val2.pickupEntries = (PickupDefEntry[])(object)new PickupDefEntry[1]
		{
			new PickupDefEntry
			{
				pickupDef = (Object)(object)newtEquip,
				pickupWeight = 1f
			}
		};
		GameObject val3 = Load<GameObject>("RoR2/Base/Shopkeeper/ShopkeeperBody.prefab");
		DeathRewards component = val3.GetComponent<DeathRewards>();
		component.bossDropTable = (PickupDropTable)(object)val2;
		component.bossPickup = new SerializablePickupIndex
		{
			pickupName = "EquipmentIndex.NewtEquip"
		};
		Object.DontDestroyOnLoad((Object)(object)val3);
		timeStopper = new GameObject("TimeStopper", new Type[3]
		{
			typeof(NetworkIdentity),
			typeof(TimeStopBehaviour),
			typeof(OutsideInteractableLocker)
		});
		timeStopper.layer = 20;
		timeStopper.transform.parent = procEffect.transform.parent;
		((Behaviour)timeStopper.GetComponent<OutsideInteractableLocker>()).enabled = false;
		OutsideInteractableLocker component2 = timeStopper.GetComponent<OutsideInteractableLocker>();
		component2.radius = 9999999f;
		((Behaviour)component2).enabled = false;
		component2.lockPrefab = Load<GameObject>("RoR2/Base/Teleporters/PurchaseLock.prefab");
		PostProcessVolume val4 = timeStopper.AddComponent<PostProcessVolume>();
		val4.profile = Object.Instantiate<PostProcessProfile>(Load<PostProcessProfile>("RoR2/Base/title/PostProcessing/ppLocalBrotherImpact.asset"));
		val4.sharedProfile = val4.profile;
		val4.weight = 1f;
		val4.priority = 99f;
		val4.isGlobal = true;
		((ParameterOverride)((ColorGrading)val4.profile.settings[1]).colorFilter).overrideState = false;
		PrefabAPI.RegisterNetworkPrefab(timeStopper);
		bool flag = false;
		ContentAddition.AddEntityState<DeathState>(ref flag);
		val3.GetComponent<CharacterDeathBehavior>().deathState = new SerializableEntityStateType(typeof(DeathState));
	}
}
internal class Sounds
{
	public static readonly uint Sound1;

	public static readonly uint Sound2;

	public static readonly uint Sound3;

	public static readonly uint Sound4;
}
internal static class Extensions
{
	public static GameObject NewSyringe(this GameObject g, params Material[] m)
	{
		((Renderer)g.GetComponentsInChildren<MeshRenderer>(false)[0]).material = m[0];
		((Renderer)g.GetComponent<TrailRenderer>()).material = m[1];
		((Renderer)g.GetComponent<ParticleSystemRenderer>()).material = m[2];
		return g;
	}

	public static Material SwapTexture(this Material m, Texture2D t)
	{
		m.mainTexture = (Texture)(object)t;
		return m;
	}

	public static GameObject SwapMaterials(this GameObject g, Material[] m)
	{
		Renderer[] componentsInChildren = g.GetComponentsInChildren<Renderer>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			if (Object.op_Implicit((Object)(object)m[i]))
			{
				componentsInChildren[i].material = m[i];
			}
		}
		return g;
	}

	public static float Mult(this float f, float mult = 100f)
	{
		return f * mult;
	}

	public static Color ToRGB255(this Color c, string title, string body)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: 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_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		return new Color(c.r / 255f, c.g / 255f, c.b / 255f);
	}

	public static void SetStrings(this TooltipProvider t, string title, string body)
	{
		t.overrideTitleText = title;
		t.overrideBodyText = body;
	}
}
internal class Utils
{
	public static Vector3 GetForwardDirection(Vector3 dir)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: 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)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: 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)
		//IL_002b: 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)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = Util.Vector3XZToVector2XY(dir);
		if (val != Vector2.zero)
		{
			((Vector2)(ref val)).Normalize();
			Vector3 val2 = new Vector3(val.x, 0f, val.y);
			return ((Vector3)(ref val2)).normalized;
		}
		return dir;
	}

	public static void PlayAnimation(GameObject g, string layerName, string animationStateName)
	{
		Animator component = g.GetComponent<Animator>();
		if (Object.op_Implicit((Object)(object)component))
		{
			int layerIndex = component.GetLayerIndex(layerName);
			component.speed = 1f;
			component.Update(0f);
			component.PlayInFixedTime(animationStateName, layerIndex, 0f);
		}
	}

	public static void PlayAnimation(GameObject g, string layerName, string animationStateName, string playbackRateParam, float duration)
	{
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		Animator component = g.GetComponent<Animator>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.speed = 1f;
			component.Update(0f);
			int layerIndex = component.GetLayerIndex(layerName);
			component.SetFloat(playbackRateParam, 1f);
			component.PlayInFixedTime(animationStateName, layerIndex, 0f);
			component.Update(0f);
			AnimatorStateInfo currentAnimatorStateInfo = component.GetCurrentAnimatorStateInfo(layerIndex);
			float length = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).length;
			component.SetFloat(playbackRateParam, length / duration);
		}
	}

	public static void AnimatorPlayAnimation(Animator modelAnimator, string layerName, string animationStateName)
	{
		int layerIndex = modelAnimator.GetLayerIndex(layerName);
		modelAnimator.speed = 1f;
		modelAnimator.Update(0f);
		modelAnimator.PlayInFixedTime(animationStateName, layerIndex, 0f);
	}

	public static void AnimatorPlayAnimation(Animator modelAnimator, string layerName, string animationStateName, string playbackRateParam, float duration)
	{
		//IL_004a: 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)
		modelAnimator.speed = 1f;
		modelAnimator.Update(0f);
		int layerIndex = modelAnimator.GetLayerIndex(layerName);
		modelAnimator.SetFloat(playbackRateParam, 1f);
		modelAnimator.PlayInFixedTime(animationStateName, layerIndex, 0f);
		modelAnimator.Update(0f);
		AnimatorStateInfo currentAnimatorStateInfo = modelAnimator.GetCurrentAnimatorStateInfo(layerIndex);
		float length = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).length;
		modelAnimator.SetFloat(playbackRateParam, length / duration);
	}

	public static SkillDef NewSkillDef<T>(Type activationState, string activationStateMachineName, int baseMaxStock, float baseRechargeInterval, bool beginSkillCooldownOnSkillEnd, bool canceledFromSprinting, bool fullRestockOnAssign, InterruptPriority interruptPriority, bool isCombatSkill, bool mustKeyPress, bool cancelSprintingOnActivation, int rechargeStock, int requiredStock, int stockToConsume, Sprite icon, string skillDescriptionToken, string skillName, params string[] keywordTokens) where T : SkillDef
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		T val = ScriptableObject.CreateInstance<T>();
		((SkillDef)val).activationState = new SerializableEntityStateType(activationState);
		((SkillDef)val).activationStateMachineName = activationStateMachineName;
		((SkillDef)val).baseMaxStock = baseMaxStock;
		((SkillDef)val).baseRechargeInterval = baseRechargeInterval;
		((SkillDef)val).beginSkillCooldownOnSkillEnd = beginSkillCooldownOnSkillEnd;
		((SkillDef)val).canceledFromSprinting = canceledFromSprinting;
		((SkillDef)val).fullRestockOnAssign = fullRestockOnAssign;
		((SkillDef)val).interruptPriority = interruptPriority;
		((SkillDef)val).isCombatSkill = isCombatSkill;
		((SkillDef)val).mustKeyPress = mustKeyPress;
		((SkillDef)val).cancelSprintingOnActivation = cancelSprintingOnActivation;
		((SkillDef)val).rechargeStock = rechargeStock;
		((SkillDef)val).requiredStock = requiredStock;
		((SkillDef)val).stockToConsume = stockToConsume;
		((SkillDef)val).icon = icon;
		((SkillDef)val).skillDescriptionToken = skillDescriptionToken;
		((SkillDef)val).skillName = skillName;
		((SkillDef)val).skillNameToken = ((SkillDef)val).skillName;
		((SkillDef)val).keywordTokens = keywordTokens;
		ContentAddition.AddSkillDef((SkillDef)(object)val);
		return (SkillDef)(object)val;
	}

	public static Color HexTo10(string hexColor)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		char[] array = hexColor.ToCharArray();
		return new Color((float)(array[0] + array[1]), (float)(array[2] + array[3]), (float)(array[4] + array[5]), 255f) / 255f;
	}

	public static EntityStateMachine NewStateMachine<T>(GameObject obj, string customName) where T : EntityState
	{
		//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_0028: 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)
		SerializableEntityStateType val = default(SerializableEntityStateType);
		((SerializableEntityStateType)(ref val))..ctor(typeof(T));
		EntityStateMachine val2 = obj.AddComponent<EntityStateMachine>();
		val2.customName = customName;
		val2.initialStateType = val;
		val2.mainStateType = val;
		return val2;
	}

	public static GenericSkill NewGenericSkill(GameObject obj, SkillDef skill)
	{
		//IL_0031: 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_0053: Expected O, but got Unknown
		//IL_0054: 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)
		GenericSkill val = obj.AddComponent<GenericSkill>();
		SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
		val2.variants = (Variant[])(object)new Variant[1];
		val._skillFamily = val2;
		SkillFamily skillFamily = val.skillFamily;
		Variant[] variants = skillFamily.variants;
		Variant val3 = new Variant
		{
			skillDef = skill
		};
		((Variant)(ref val3)).viewableNode = new Node(skill.skillNameToken, false, (Node)null);
		variants[0] = val3;
		ContentAddition.AddSkillFamily(skillFamily);
		return val;
	}

	public static void AddAlt(SkillFamily skillFamily, SkillDef SkillDef)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected O, but got Unknown
		//IL_004c: 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)
		Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
		Variant[] variants = skillFamily.variants;
		int num = skillFamily.variants.Length - 1;
		Variant val = new Variant
		{
			skillDef = SkillDef
		};
		((Variant)(ref val)).viewableNode = new Node(SkillDef.skillNameToken, false, (Node)null);
		variants[num] = val;
	}

	public static BuffDef NewBuffDef(string name, bool stack, bool hidden, Sprite sprite, Color color)
	{
		//IL_0025: 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)
		BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
		((Object)val).name = name;
		val.canStack = stack;
		val.isHidden = hidden;
		val.iconSprite = sprite;
		val.buffColor = color;
		ContentAddition.AddBuffDef(val);
		return val;
	}

	public static ObjectScaleCurve AddScaleComponent(GameObject target, float timeMax)
	{
		ObjectScaleCurve val = target.AddComponent<ObjectScaleCurve>();
		val.useOverallCurveOnly = true;
		val.timeMax = timeMax;
		val.overallCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
		return val;
	}

	public static RotateAroundAxis AddRotationComponent(GameObject target, float speed, RotationAxis axis)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		RotateAroundAxis val = target.AddComponent<RotateAroundAxis>();
		val.speed = (Speed)2;
		val.fastRotationSpeed = speed;
		val.rotateAroundAxis = axis;
		return val;
	}

	public static GameObject NewDisplayModel(GameObject model, string name)
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		GameObject val = PrefabAPI.InstantiateClone(model, name, false);
		val.GetComponentInChildren<Animator>().runtimeAnimatorController = Assets.Load<RuntimeAnimatorController>("displayAnimator");
		((Behaviour)val.GetComponentInChildren<CharacterModel>()).enabled = false;
		SkinnedMeshRenderer[] componentsInChildren = val.GetComponentsInChildren<SkinnedMeshRenderer>(true);
		foreach (SkinnedMeshRenderer val2 in componentsInChildren)
		{
			((Renderer)val2).material = new Material(((Renderer)val2).material);
			((Renderer)val2).material.DisableKeyword("DITHER");
		}
		return val;
	}

	public static AnimateShaderAlpha AddShaderAlphaComponent(GameObject target, float timeMax, AnimationCurve curve, bool destroyOnEnd = true, bool disableOnEnd = false)
	{
		AnimateShaderAlpha val = target.AddComponent<AnimateShaderAlpha>();
		val.timeMax = timeMax;
		val.alphaCurve = curve;
		val.destroyOnEnd = destroyOnEnd;
		val.disableOnEnd = disableOnEnd;
		return val;
	}

	internal static Sprite CreateSprite(Texture2D tex)
	{
		//IL_001a: 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)
		return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f), 128f);
	}

	internal static SkinDefInfo CreateNewSkinDefInfo(SkinnedMeshRenderer[] childList, GameObject rootObject, string skinName, string objectToEnable, RendererInfo[] rendererInfos, UnlockableDef unlockableDef = null)
	{
		//IL_0003: 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_006c: 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_0071: 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_00db: 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)
		SkinDefInfo result = default(SkinDefInfo);
		result.BaseSkins = Array.Empty<SkinDef>();
		result.MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0];
		result.ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0];
		List<GameObjectActivation> list = new List<GameObjectActivation>();
		foreach (SkinnedMeshRenderer val in childList)
		{
			GameObjectActivation val2 = default(GameObjectActivation);
			val2.gameObject = ((Component)val).gameObject;
			val2.shouldActivate = ((Object)val).name == objectToEnable;
			GameObjectActivation item = val2;
			list.Add(item);
		}
		result.GameObjectActivations = list.ToArray();
		result.Icon = Assets.MainAssetBundle.LoadAsset<Sprite>(objectToEnable);
		result.MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0];
		result.Name = skinName;
		result.NameToken = skinName;
		result.RendererInfos = rendererInfos;
		result.RootObject = rootObject;
		result.UnlockableDef = unlockableDef;
		return result;
	}

	internal static T CopyComponent<T>(T original, GameObject destination) where T : Component
	{
		Type type = ((object)original).GetType();
		Component val = destination.AddComponent(type);
		FieldInfo[] fields = type.GetFields();
		FieldInfo[] array = fields;
		foreach (FieldInfo fieldInfo in array)
		{
			fieldInfo.SetValue(val, fieldInfo.GetValue(original));
		}
		return (T)(object)((val is T) ? val : null);
	}

	public static Sprite CreateSpriteFromTexture(Texture2D texture)
	{
		//IL_0025: 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)
		if (Object.op_Implicit((Object)(object)texture))
		{
			return Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f));
		}
		return null;
	}

	public static GameObject FindInActiveObjectByName(string name)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Invalid comparison between Unknown and I4
		Transform[] array = Resources.FindObjectsOfTypeAll<Transform>();
		for (int i = 0; i < array.Length; i++)
		{
			if ((int)((Object)array[i]).hideFlags == 0 && ((Object)array[i]).name == name)
			{
				return ((Component)array[i]).gameObject;
			}
		}
		return null;
	}

	public static void CreateHitboxes(string name, Transform parent, Vector3[] sizes, Vector3[] positions)
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		//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_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_0082: Unknown result type (might be due to invalid IL or missing references)
		HitBoxGroup val = ((Component)parent).gameObject.AddComponent<HitBoxGroup>();
		val.groupName = name;
		List<HitBox> list = new List<HitBox>();
		for (int i = 0; i < sizes.Length; i++)
		{
			GameObject val2 = new GameObject(name + (i + 1));
			val2.transform.SetParent(parent);
			val2.transform.localPosition = positions[i];
			val2.transform.localRotation = Quaternion.Euler(Vector3.forward * 45f);
			val2.transform.localScale = sizes[i];
			HitBox item = val2.AddComponent<HitBox>();
			val2.layer = LayerIndex.projectile.intVal;
			list.Add(item);
		}
		val.hitBoxes = list.ToArray();
	}

	public static GameObject CreateHitbox(string name, Transform parent, Vector3 scale, Vector3 localPosition)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		//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)
		//IL_0032: 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_0048: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject(name);
		val.transform.SetParent(parent);
		val.transform.localPosition = localPosition;
		val.transform.localRotation = Quaternion.Euler(Vector3.forward * 45f);
		val.transform.localScale = scale;
		HitBoxGroup val2 = ((Component)parent).gameObject.AddComponent<HitBoxGroup>();
		HitBox val3 = val.AddComponent<HitBox>();
		val.layer = LayerIndex.projectile.intVal;
		val2.hitBoxes = (HitBox[])(object)new HitBox[1] { val3 };
		val2.groupName = name;
		return val;
	}

	internal static EffectComponent RegisterEffect(GameObject effect, float duration, string soundName = "", bool applyScale = false, bool parentToReferencedTransform = true, bool positionAtReferencedTransform = true)
	{
		//IL_00a6: 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)
		EffectComponent val = effect.GetComponent<EffectComponent>();
		if (!Object.op_Implicit((Object)(object)val))
		{
			val = effect.AddComponent<EffectComponent>();
		}
		if (duration != -1f)
		{
			DestroyOnTimer component = effect.GetComponent<DestroyOnTimer>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				effect.AddComponent<DestroyOnTimer>().duration = duration;
			}
			else
			{
				component.duration = duration;
			}
		}
		if (!Object.op_Implicit((Object)(object)effect.GetComponent<NetworkIdentity>()))
		{
			effect.AddComponent<NetworkIdentity>();
		}
		if (!Object.op_Implicit((Object)(object)effect.GetComponent<VFXAttributes>()))
		{
			effect.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
		}
		val.applyScale = applyScale;
		val.effectIndex = (EffectIndex)(-1);
		val.parentToReferencedTransform = parentToReferencedTransform;
		val.positionAtReferencedTransform = positionAtReferencedTransform;
		val.soundName = soundName;
		ContentAddition.AddEffect(effect);
		return val;
	}

	public static Material InstantiateMaterial(Texture tex)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		Material val = Object.Instantiate<Material>(Prefabs.Load<Material>("RoR2/Base/Commando/matCommandoDualies.mat"));
		if (Object.op_Implicit((Object)(object)val))
		{
			val.SetColor("_Color", Color.white);
			val.SetTexture("_MainTex", tex);
			val.SetColor("_EmColor", Color.black);
			val.SetFloat("_EmPower", 0f);
			val.SetTexture("_EmTex", (Texture)null);
			val.SetFloat("_NormalStrength", 1f);
			val.SetTexture("_NormalTex", (Texture)null);
			return val;
		}
		return val;
	}

	public static Material InstantiateMaterial(Color color, Texture tex, Color emColor, float emPower, Texture emTex, float normStr, Texture normTex)
	{
		//IL_0037: 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)
		Material val = Object.Instantiate<Material>(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<CharacterModel>().baseRendererInfos[0].defaultMaterial);
		if (Object.op_Implicit((Object)(object)val))
		{
			val.SetColor("_Color", color);
			val.SetTexture("_MainTex", tex);
			val.SetColor("_EmColor", emColor);
			val.SetFloat("_EmPower", emPower);
			val.SetTexture("_EmTex", emTex);
			val.SetFloat("_NormalStrength", 1f);
			val.SetTexture("_NormalTex", normTex);
			return val;
		}
		return val;
	}

	public static Material FindMaterial(string name)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Invalid comparison between Unknown and I4
		Material[] array = Resources.FindObjectsOfTypeAll<Material>();
		for (int i = 0; i < array.Length; i++)
		{
			if ((int)((Object)array[i]).hideFlags == 0 && ((Object)array[i]).name == name)
			{
				return array[i];
			}
		}
		return null;
	}
}