Decompiled source of BloodthirstCirclet v1.0.0

ShrineItemMod.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EntityStates;
using On.RoR2;
using R2API;
using R2API.Utils;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering.PostProcessing;

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

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("ShrineItemMod.AssetBundle." + "ShrineItemMod".ToLower() + "assets"))
			{
				MainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
		}
	}
}
internal class PurchaseCountBehaviour : MonoBehaviour
{
	private PurchaseInteraction purchaseInteraction;

	private ShrineBehavior shrineBehaviour;

	private int baseStacks;

	private FieldInfo maxPurchaseCount;

	private bool detonated;

	private bool alliesSpawned;

	private bool bossSetup;

	private void Awake()
	{
		purchaseInteraction = ((Component)this).GetComponent<PurchaseInteraction>();
		shrineBehaviour = ((Component)this).GetComponent<ShrineBehavior>();
		maxPurchaseCount = ((object)shrineBehaviour).GetType().GetField("maxPurchaseCount", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
		if (maxPurchaseCount != null)
		{
			baseStacks = (int)maxPurchaseCount.GetValue(shrineBehaviour);
		}
	}

	private void Start()
	{
		UpdatePurchaseCount();
		PurchaseCountManager.updatePurchaseCount += PurchaseCountManager_updatePurchaseCount;
	}

	private void PurchaseCountManager_updatePurchaseCount(PurchaseCountManager p)
	{
		UpdatePurchaseCount();
	}

	private void OnDisable()
	{
		PurchaseCountManager.updatePurchaseCount -= PurchaseCountManager_updatePurchaseCount;
	}

	private void UpdatePurchaseCount()
	{
		if (!(maxPurchaseCount == null) && Object.op_Implicit((Object)(object)PurchaseCountManager.instance))
		{
			maxPurchaseCount.SetValue(shrineBehaviour, baseStacks + PurchaseCountManager.instance.additionalInteractionCount);
		}
	}
}
internal class PurchaseCountManager : NetworkBehaviour
{
	public static PurchaseCountManager instance;

	public bool spawnImp = false;

	public GameObject summoner;

	public List<CharacterMaster> imps = new List<CharacterMaster>();

	[SyncVar]
	public int additionalInteractionCount = 0;

	public string fuckthisshiot = "Play_voidDevastator_m2_primary_explo";

	private static int kRpcRpcUpdatePurchaseCount;

	public int NetworkadditionalInteractionCount
	{
		get
		{
			return additionalInteractionCount;
		}
		[param: In]
		set
		{
			((NetworkBehaviour)this).SetSyncVar<int>(value, ref additionalInteractionCount, 1u);
		}
	}

	public static event Action<PurchaseCountManager> updatePurchaseCount;

	private void OnEnable()
	{
		TeleporterInteraction.onTeleporterBeginChargingGlobal += TeleporterInteraction_onTeleporterBeginChargingGlobal;
		TeleporterInteraction.onTeleporterFinishGlobal += TeleporterInteraction_onTeleporterFinishGlobal;
	}

	private void TeleporterInteraction_onTeleporterFinishGlobal(TeleporterInteraction obj)
	{
		KillImps();
	}

	private void KillImps()
	{
		if (!NetworkServer.active)
		{
			return;
		}
		foreach (CharacterMaster imp in imps)
		{
			imp.TrueKill();
		}
		imps.Clear();
	}

	private void OnDisable()
	{
		KillImps();
		TeleporterInteraction.onTeleporterBeginChargingGlobal -= TeleporterInteraction_onTeleporterBeginChargingGlobal;
		TeleporterInteraction.onTeleporterFinishGlobal -= TeleporterInteraction_onTeleporterFinishGlobal;
	}

	private void TeleporterInteraction_onTeleporterBeginChargingGlobal(TeleporterInteraction teleporter)
	{
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Expected O, but got Unknown
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: 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 (!spawnImp || !NetworkServer.active)
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)summoner))
		{
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				CharacterBody body = instance.body;
				if (Object.op_Implicit((Object)(object)body))
				{
					summoner = ((Component)body).gameObject;
					break;
				}
			}
		}
		MasterSummon val = new MasterSummon();
		val.masterPrefab = Prefabs.Load<GameObject>("RoR2/Base/ImpBoss/ImpBossMaster.prefab");
		val.position = Utils.FindNearestNodePosition(((Component)teleporter).transform.position, (GraphType)0);
		val.rotation = Quaternion.identity;
		val.summonerBodyObject = summoner;
		val.ignoreTeamMemberLimit = true;
		val.useAmbientLevel = true;
		CharacterMaster val2 = val.Perform();
		if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.inventory))
		{
			imps.Add(val2);
		}
	}

	private void Start()
	{
		instance = this;
		if (NetworkServer.active)
		{
			CallRpcUpdatePurchaseCount();
		}
	}

	[ClientRpc]
	public void RpcUpdatePurchaseCount()
	{
		int num = 0;
		foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
		{
			if (Object.op_Implicit((Object)(object)instance.master) && Object.op_Implicit((Object)(object)instance.master.inventory))
			{
				num += instance.master.inventory.GetItemCount(Prefabs.item);
			}
		}
		NetworkadditionalInteractionCount = num;
		PurchaseCountManager.updatePurchaseCount?.Invoke(this);
	}

	private void UNetVersion()
	{
	}

	protected static void InvokeRpcRpcUpdatePurchaseCount(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"RPC RpcUpdatePurchaseCount called on server.");
		}
		else
		{
			((PurchaseCountManager)(object)obj).RpcUpdatePurchaseCount();
		}
	}

	public void CallRpcUpdatePurchaseCount()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"RPC Function RpcUpdatePurchaseCount called on client.");
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)2);
		val.WritePackedUInt32((uint)kRpcRpcUpdatePurchaseCount);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcUpdatePurchaseCount");
	}

	static PurchaseCountManager()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		kRpcRpcUpdatePurchaseCount = -1419673968;
		NetworkBehaviour.RegisterRpcDelegate(typeof(PurchaseCountManager), kRpcRpcUpdatePurchaseCount, new CmdDelegate(InvokeRpcRpcUpdatePurchaseCount));
		NetworkCRC.RegisterBehaviour("PurchaseCountManager", 0);
	}

	public override bool OnSerialize(NetworkWriter writer, bool forceAll)
	{
		if (forceAll)
		{
			writer.WritePackedUInt32((uint)additionalInteractionCount);
			return true;
		}
		bool flag = false;
		if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
		{
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
				flag = true;
			}
			writer.WritePackedUInt32((uint)additionalInteractionCount);
		}
		if (!flag)
		{
			writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
		}
		return flag;
	}

	public override void OnDeserialize(NetworkReader reader, bool initialState)
	{
		if (initialState)
		{
			additionalInteractionCount = (int)reader.ReadPackedUInt32();
			return;
		}
		int num = (int)reader.ReadPackedUInt32();
		if (((uint)num & (true ? 1u : 0u)) != 0)
		{
			additionalInteractionCount = (int)reader.ReadPackedUInt32();
		}
	}
}
internal class Hook
{
	internal static void Hooks()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Expected O, but got Unknown
		Stage.onStageStartGlobal += Stage_onStageStartGlobal;
		PurchaseInteraction.Awake += new hook_Awake(PurchaseInteraction_Awake);
		Inventory.onInventoryChangedGlobal += delegate(Inventory i)
		{
			if (Object.op_Implicit((Object)(object)((Component)i).GetComponent<PlayerCharacterMasterController>()))
			{
				CallUpdate();
			}
		};
		CharacterBody.onBodyStartGlobal += delegate(CharacterBody b)
		{
			if (b.isPlayerControlled)
			{
				CallUpdate();
			}
		};
		CharacterBody.onBodyDestroyGlobal += delegate(CharacterBody b)
		{
			if (b.isPlayerControlled)
			{
				CallUpdate();
			}
		};
		ShrineBloodBehavior.AddShrineStack += new hook_AddShrineStack(ShrineBloodBehavior_AddShrineStack);
		static void CallUpdate()
		{
			if (NetworkServer.active && Object.op_Implicit((Object)(object)PurchaseCountManager.instance))
			{
				PurchaseCountManager.instance.CallRpcUpdatePurchaseCount();
			}
		}
	}

	private static void Stage_onStageStartGlobal(Stage obj)
	{
		if (NetworkServer.active)
		{
			NetworkServer.Spawn(Object.Instantiate<GameObject>(Prefabs.manager));
		}
	}

	private static void ShrineBloodBehavior_AddShrineStack(orig_AddShrineStack orig, ShrineBloodBehavior self, Interactor interactor)
	{
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Expected O, but got Unknown
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Expected O, but got Unknown
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		orig.Invoke(self, interactor);
		if (!Object.op_Implicit((Object)(object)PurchaseCountManager.instance) || PurchaseCountManager.instance.additionalInteractionCount <= 0)
		{
			return;
		}
		CharacterBody component = ((Component)interactor).GetComponent<CharacterBody>();
		FireworkLauncher component2 = Object.Instantiate<GameObject>(Prefabs.Load<GameObject>("RoR2/Base/Firework/FireworkLauncher.prefab"), ((Component)self).transform.position + Vector3.up * 1.5f, Quaternion.identity).GetComponent<FireworkLauncher>();
		component2.owner = ((Component)interactor).gameObject;
		component2.damageCoefficient = 8f;
		component2.crit = component.RollCrit();
		component2.remaining = self.purchaseCount + 1;
		component2.projectilePrefab = Prefabs.missileProjectile;
		switch (self.purchaseCount)
		{
		case 4:
			break;
		case 5:
		{
			if (!Object.op_Implicit((Object)(object)PurchaseCountManager.instance))
			{
				break;
			}
			for (int i = 0; i < 2; i++)
			{
				MasterSummon val = new MasterSummon();
				val.masterPrefab = Prefabs.Load<GameObject>("RoR2/Base/Imp/ImpMaster.prefab");
				val.position = Utils.FindNearestNodePosition(((Component)self).transform.position, (GraphType)0);
				val.rotation = Quaternion.identity;
				val.summonerBodyObject = ((Component)component).gameObject;
				val.ignoreTeamMemberLimit = true;
				val.useAmbientLevel = true;
				CharacterMaster val2 = val.Perform();
				if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.inventory))
				{
					PurchaseCountManager.instance.imps.Add(val2);
					val2.inventory.GiveItem(Items.BoostDamage, 30);
					val2.inventory.GiveItem(Items.BoostHp, 30);
				}
			}
			break;
		}
		case 6:
			if (Object.op_Implicit((Object)(object)PurchaseCountManager.instance))
			{
				PurchaseCountManager.instance.summoner = ((Component)interactor).gameObject;
				PurchaseCountManager.instance.spawnImp = true;
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "BLOODSHRINE_BOSS_MESSAGE"
				});
			}
			break;
		}
	}

	private static void PurchaseInteraction_Awake(orig_Awake orig, PurchaseInteraction self)
	{
		orig.Invoke(self);
		if (Object.op_Implicit((Object)(object)((Component)self).GetComponent<ShrineBehavior>()))
		{
			((Component)self).gameObject.AddComponent<PurchaseCountBehaviour>();
		}
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Dragonyck.ShrineItemMod", "ShrineItemMod", "1.0.0")]
public class MainPlugin : BaseUnityPlugin
{
	public const string MODUID = "com.Dragonyck.ShrineItemMod";

	public const string MODNAME = "ShrineItemMod";

	public const string VERSION = "1.0.0";

	private void Awake()
	{
		Assets.PopulateAssets();
		Prefabs.CreatePrefabs();
		Hook.Hooks();
	}
}
internal class Prefabs
{
	internal static GameObject missileProjectileGhost;

	internal static GameObject missileProjectile;

	internal static GameObject manager;

	internal static GameObject explosion;

	internal static ItemDef item;

	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_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Expected O, but got Unknown
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_030e: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("dontDestroyOnLoad");
		val.SetActive(false);
		Object.DontDestroyOnLoad((Object)(object)val);
		manager = new GameObject("PurchaseCountManager", new Type[2]
		{
			typeof(NetworkIdentity),
			typeof(PurchaseCountManager)
		});
		manager.transform.parent = val.transform;
		PrefabAPI.RegisterNetworkPrefab(manager);
		LanguageAPI.Add("BLOODSHRINE_BOSS_MESSAGE", "<style=cIsHealth>An Overlord watches over you.</style>");
		explosion = Instantiate("RoR2/Base/ImpBoss/ImpBossBlink.prefab", "ExplosionEffect");
		explosion.GetComponent<EffectComponent>().soundName = "Play_imp_overlord_attack1_pop";
		ShakeEmitter[] components = explosion.GetComponents<ShakeEmitter>();
		foreach (ShakeEmitter val2 in components)
		{
			val2.radius = 5f;
		}
		((Behaviour)explosion.GetComponentInChildren<PostProcessVolume>()).enabled = false;
		ContentAddition.AddEffect(explosion);
		missileProjectileGhost = Instantiate("RoR2/Base/ImpBoss/ImpVoidspikeProjectileGhost.prefab", "MissileProjectileGhost");
		missileProjectile = Instantiate("RoR2/Base/Common/MissileProjectile.prefab", "MissileProjectile");
		ProjectileController component = missileProjectile.GetComponent<ProjectileController>();
		component.ghostPrefab = missileProjectileGhost;
		component.startSound = "Play_imp_attack_tell";
		missileProjectile.GetComponent<ProjectileDamage>().damageColorIndex = (DamageColorIndex)3;
		Object.Destroy((Object)(object)missileProjectile.GetComponent<ProjectileSingleTargetImpact>());
		Object.Destroy((Object)(object)missileProjectile.GetComponent<AkEvent>());
		ProjectileImpactExplosion val3 = missileProjectile.AddComponent<ProjectileImpactExplosion>();
		val3.impactEffect = explosion;
		val3.lifetime = 20f;
		val3.destroyOnEnemy = true;
		val3.destroyOnWorld = true;
		((ProjectileExplosion)val3).blastAttackerFiltering = (AttackerFiltering)2;
		((ProjectileExplosion)val3).blastRadius = 10f;
		((ProjectileExplosion)val3).blastDamageCoefficient = 1f;
		((ProjectileExplosion)val3).blastProcCoefficient = 0f;
		((ProjectileExplosion)val3).falloffModel = (FalloffModel)0;
		ContentAddition.AddProjectile(missileProjectile);
		LanguageAPI.Add("SHRINEITEM_NAME", "Bloodthirst Circlet");
		LanguageAPI.Add("SHRINEITEM_DESC", "Shrines can be used <style=cIsUtility>1</style> <style=cStack>(+1 per stack)</style> more times. Shrines of Blood are empowered, with further uses being <style=cIsDamage>amplified</style>.");
		LanguageAPI.Add("SHRINEITEM_PICKUP", "Shrines can be used again.");
		LanguageAPI.Add("SHRINEITEM_LORE", "> Automated report cmVkcGxhbmUtY29tbXVuaWNhdGlvbnM= is now available from site record UmVkIFBsYW5lIEN1bHR1cmFsIEFjY3VtdWxhdGlvbg==.\r\n\r\n> Please refer to record UmVkIFBsYW5lIEN1bHR1cmFsIEFjY3VtdWxhdGlvbg== for additional details during your review.\r\n\r\n> Machine-generated Transcription> base Vernacular Profile “Gauge-weasle”\r\n\r\n> - Source: 6747a1a75787e7a92375a0d86974657d (Unknown Material Artifact #6636)\r\n\r\n> Priority: High\r\n\r\n> Report Content:" + Environment.NewLine + "-- Beginning of Excerpt Flagged for Review –\r\n\r\nAnother sacrifice has been made. A slave to be used torn apart by the rend, his essence consumed to fuel [the melting shrine] to penetrate the membrane.\r\n\r\nThe Baron-Priests words were channeled by [the melting shrine], a message to the emperor deign. [our eminence] had previously sent reinforcement, but it turned futile as communications were lost within 3-distortion of dispatchment location. Communications abruptly ceased between the strandeds after sending a scouting dispatch to their location. It was clear that they were weakened by the planet 'deity' - and to have lost all [pearl] infuriated the emperor deign. The performance concluded, and we felt a surge of aura and power coursing through the chamber. A response from the Red Plane's mighty felt imminent." + Environment.NewLine + "There will be no repeats of the last squadron's incumbent scavenge.\r\n\r\nThe Baron-Priest's crown circlet exudes a sustain - and we marched through [between space]. May we grant this defiant deity of the planet a swift execution." + Environment.NewLine + "Hail to the Red-Plane." + Environment.NewLine + "-- End of Recording –" + Environment.NewLine + "-- End of Excerpt Flagged for Review –" + Environment.NewLine + "> TRANSLATION ERRORS: 4\r\n\r\n> 1> [the melting shrine] could not be fully translated.\r\n\r\n> 2> [pearl] could not be fully translated.\r\n\r\n> 3> [our eminence] could not be fully translated.\r\n\r\n> 4> [between space] could not be fully translated." + Environment.NewLine + "> Please refer to report Ymxvb2RjbGF3c3F1YWQgcmVwb3J0 for full audio excerpt.\r\n\r\n===================================================");
		item = ScriptableObject.CreateInstance<ItemDef>();
		((Object)item).name = "ShrineItem";
		item.nameToken = "SHRINEITEM_NAME";
		item.descriptionToken = "SHRINEITEM_DESC";
		item.pickupToken = "SHRINEITEM_PICKUP";
		item.loreToken = "SHRINEITEM_LORE";
		item.pickupIconSprite = Assets.Load<Sprite>("icon");
		item.deprecatedTier = (ItemTier)1;
		item.tier = (ItemTier)1;
		item.tags = (ItemTag[])(object)new ItemTag[2]
		{
			(ItemTag)18,
			(ItemTag)3
		};
		ContentAddition.AddItemDef(item);
		item.pickupModelPrefab = Instantiate(Assets.Load<GameObject>("circletMdl"), "ShrineItemModel");
		Material[] array = (Material[])(object)new Material[4]
		{
			Load<Material>("RoR2/DLC1/Railgunner/matRailGunnerAltColossusMetal.mat"),
			Load<Material>("RoR2/DLC1/VoidCoinBarrel/matVoidCoinBarrel.mat"),
			Load<Material>("RoR2/Base/Common/TrimSheets/matTrimSheetMetalMilitaryPink.mat"),
			Load<Material>("RoR2/DLC1/VoidRaidCrab/matVoidRaidCrabTripleBeamSphere1.mat")
		};
		MeshRenderer[] componentsInChildren = item.pickupModelPrefab.GetComponentsInChildren<MeshRenderer>();
		for (int j = 0; j < componentsInChildren.Length; j++)
		{
			((Renderer)componentsInChildren[j]).material = array[j];
		}
		ChildLocator component2 = item.pickupModelPrefab.GetComponent<ChildLocator>();
		ModelPanelParameters val4 = item.pickupModelPrefab.AddComponent<ModelPanelParameters>();
		val4.focusPointTransform = component2.FindChild("FocusPoint");
		val4.cameraPositionTransform = component2.FindChild("CameraPosition");
	}
}
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 FindNearestNodePosition(Vector3 targetPosition, GraphType nodeGraphType)
	{
		//IL_0009: 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_0010: 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_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0039: 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_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Expected O, but got Unknown
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Expected O, but got Unknown
		//IL_0061: 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_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		SpawnCard val = ScriptableObject.CreateInstance<SpawnCard>();
		val.hullSize = (HullClassification)1;
		val.nodeGraphType = nodeGraphType;
		val.prefab = Prefabs.Load<GameObject>("RoR2/Base/Common/DirectorSpawnProbeHelperPrefab.prefab");
		Vector3 result = targetPosition;
		GameObject val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, new DirectorPlacementRule
		{
			placementMode = (PlacementMode)3,
			position = targetPosition
		}, RoR2Application.rng));
		if (Object.op_Implicit((Object)(object)val2))
		{
			result = val2.transform.position;
		}
		if (Object.op_Implicit((Object)(object)val2))
		{
			Object.Destroy((Object)(object)val2);
		}
		Object.Destroy((Object)(object)val);
		return result;
	}

	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;
	}
}