Decompiled source of BentosBonanza v1.0.0

BentoItems.dll

Decompiled 18 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 EntityStates;
using On.RoR2;
using R2API;
using R2API.Utils;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.Navigation;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[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("BentoItems")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BentoItems")]
[assembly: AssemblyTitle("BentoItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BentoItems;

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("BentoItems.AssetBundle.bentoitemsassets"))
			{
				MainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
		}
	}
}
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
		//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
		RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
		EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(EquipmentSlot_PerformEquipmentAction);
		HealthComponent.Heal += new hook_Heal(HealthComponent_Heal);
		HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
		GlobalEventManager.OnInteractionsGlobal += GlobalEventManager_OnInteractionsGlobal;
	}

	private static void GlobalEventManager_OnInteractionsGlobal(Interactor interactor, IInteractable interactable, GameObject interactableObject)
	{
		CharacterBody component = ((Component)interactor).GetComponent<CharacterBody>();
		if (!NetworkServer.active || !Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.inventory))
		{
			return;
		}
		PickupPickerController component2 = interactableObject.GetComponent<PickupPickerController>();
		if (!Object.op_Implicit((Object)(object)component2) || (Object.op_Implicit((Object)(object)component2) && !((Behaviour)component2).enabled))
		{
			int itemCountEffective = component.inventory.GetItemCountEffective(Prefabs.book);
			if (itemCountEffective > 0)
			{
				component.inventory.DeductActiveEquipmentCooldown(4f * (float)itemCountEffective);
			}
		}
	}

	private static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
	{
		if (Object.op_Implicit((Object)(object)self.body.inventory))
		{
			int itemCountEffective = self.body.inventory.GetItemCountEffective(Prefabs.femur);
			if (itemCountEffective > 0 && Object.op_Implicit((Object)(object)damageInfo.attacker) && !Object.op_Implicit((Object)(object)damageInfo.attacker.GetComponent<PurchaseInteraction>()))
			{
				damageInfo.damage *= 1f + 0.5f * (float)itemCountEffective;
			}
		}
		orig.Invoke(self, damageInfo);
	}

	private static float HealthComponent_Heal(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool nonRegen)
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		if (nonRegen && Object.op_Implicit((Object)(object)self.body.inventory))
		{
			int itemCountEffective = self.body.inventory.GetItemCountEffective(Prefabs.boots);
			if (itemCountEffective > 0)
			{
				amount *= 1f + 0.5f * (float)itemCountEffective;
			}
		}
		return orig.Invoke(self, amount, procChainMask, nonRegen);
	}

	private static bool EquipmentSlot_PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Expected O, but got Unknown
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Expected O, but got Unknown
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)self.characterBody))
		{
			if ((Object)(object)equipmentDef == (Object)(object)Prefabs.lettice)
			{
				self.characterBody.AddTimedBuff(Prefabs.letticeBuff, 15f);
				EffectData val = new EffectData();
				val.origin = ((Component)self).transform.position;
				val.SetNetworkedObjectReference(((Component)self).gameObject);
				EffectManager.SpawnEffect(Prefabs.letticeActivationEffect, val, true);
				return true;
			}
			if ((Object)(object)equipmentDef == (Object)(object)Prefabs.trophy)
			{
				EffectManager.SpawnEffect(Prefabs.Load<GameObject>("RoR2/Base/LunarSkillReplacements/LunarSecondaryExplosion.prefab"), new EffectData
				{
					origin = self.characterBody.corePosition,
					scale = 9f
				}, true);
				BullseyeSearch val2 = new BullseyeSearch();
				val2.filterByDistinctEntity = true;
				val2.filterByLoS = false;
				val2.minDistanceFilter = 0f;
				val2.maxDistanceFilter = 90f;
				val2.minAngleFilter = 0f;
				val2.maxAngleFilter = 180f;
				val2.sortMode = (SortMode)1;
				val2.teamMaskFilter = TeamMask.GetUnprotectedTeams(self.characterBody.teamComponent.teamIndex);
				val2.searchOrigin = self.characterBody.corePosition;
				val2.viewer = null;
				val2.RefreshCandidates();
				val2.FilterOutGameObject(((Component)self.characterBody).gameObject);
				foreach (HurtBox result in val2.GetResults())
				{
					if (result.healthComponent.alive)
					{
						for (int i = 0; i < 20; i++)
						{
							result.healthComponent.body.AddTimedBuff(Buffs.LunarDetonationCharge, 10f);
						}
					}
				}
				if (Object.op_Implicit((Object)(object)self.characterBody.inventory))
				{
					self.characterBody.inventory.AddItemIfNotPresent(Items.LunarPrimaryReplacement);
					self.characterBody.inventory.AddItemIfNotPresent(Items.LunarSecondaryReplacement);
					self.characterBody.inventory.AddItemIfNotPresent(Items.LunarUtilityReplacement);
					self.characterBody.inventory.AddItemIfNotPresent(Items.LunarSpecialReplacement);
				}
				return true;
			}
		}
		return orig.Invoke(self, equipmentDef);
	}

	private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
	{
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)sender.inventory))
		{
			int itemCountEffective = sender.inventory.GetItemCountEffective(Prefabs.scalpel);
			if (itemCountEffective > 0)
			{
				args.critAdd += (float)(5 * itemCountEffective);
				args.bleedChanceAdd += 5f * (float)itemCountEffective;
			}
			itemCountEffective = sender.inventory.GetItemCountEffective(Prefabs.boots);
			if (itemCountEffective > 0)
			{
				args.damageMultAdd += 0.5f * (float)itemCountEffective;
			}
			if (sender.equipmentSlot.equipmentIndex == Prefabs.lettice.equipmentIndex)
			{
				args.luckAdd += 2f;
			}
			if (sender.HasBuff(Prefabs.letticeBuff))
			{
				args.luckAdd += 6f;
			}
			itemCountEffective = sender.inventory.GetItemCountEffective(Prefabs.femur);
			if (itemCountEffective > 0)
			{
				args.moveSpeedMultAdd += 0.75f * (float)itemCountEffective;
			}
		}
	}
}
[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.BentosBonanza", "BentosBonanza", "1.0.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class MainPlugin : BaseUnityPlugin
{
	public const string MODUID = "com.Dragonyck.BentosBonanza";

	public const string MODNAME = "BentosBonanza";

	public const string VERSION = "1.0.0";

	private void Awake()
	{
		Assets.PopulateAssets();
		Prefabs.CreatePrefabs();
		Hook.Hooks();
	}
}
internal class Prefabs
{
	internal const string Prefix = "BENTO_";

	internal static GameObject baseItemDisplay;

	internal static GameObject letticeActivationEffect;

	internal static ItemDef scalpel;

	internal static ItemDef book;

	internal static ItemDef boots;

	internal static EquipmentDef lettice;

	internal static ItemDef femur;

	internal static EquipmentDef trophy;

	internal static BuffDef bookBuff;

	internal static BuffDef letticeBuff;

	internal static void CreatePrefabs()
	{
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Expected O, but got Unknown
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Expected O, but got Unknown
		Load<SkillDef>("RoR2/Base/LunarSkillReplacements/LunarPrimaryReplacement.asset").fullRestockOnAssign = true;
		Load<SkillDef>("RoR2/Base/LunarSkillReplacements/LunarSecondaryReplacement.asset").fullRestockOnAssign = true;
		Load<SkillDef>("RoR2/Base/LunarSkillReplacements/LunarUtilityReplacement.asset").fullRestockOnAssign = true;
		Load<SkillDef>("RoR2/Base/LunarSkillReplacements/LunarDetonatorSpecialReplacement.asset").fullRestockOnAssign = true;
		Sprite val = Assets.Load<Sprite>("cloverBuffIcon");
		letticeBuff = Utils.NewBuffDef("Lettice", stack: false, hidden: false, val, Color32.op_Implicit(new Color32((byte)144, (byte)238, (byte)144, byte.MaxValue)));
		letticeActivationEffect = Instantiate("RoR2/Base/Fruit/FruitHealEffect.prefab", "LetticeActivationEffect");
		ParticleSystemRenderer[] componentsInChildren = letticeActivationEffect.GetComponentsInChildren<ParticleSystemRenderer>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			ParticleSystemRenderer val2 = componentsInChildren[i];
			switch (i)
			{
			case 0:
				val2.trailMaterial = Load<Material>("RoR2/Base/Huntress/matHuntressFlurryArrowTrail.mat");
				break;
			case 1:
			{
				Material val3 = new Material(Load<Material>("RoR2/Base/Common/VFX/matHealingCross.mat"));
				val3.SetTexture("_MainTex", (Texture)(object)val.texture);
				val3.SetTexture("_RemapTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/ColorRamps/texRampHuntressSoft2.png"));
				((Renderer)val2).material = val3;
				break;
			}
			default:
				((Component)val2).gameObject.SetActive(false);
				break;
			}
		}
		ContentAddition.AddEffect(letticeActivationEffect);
		baseItemDisplay = Assets.Load<GameObject>("ItemMdl");
		Renderer[] componentsInChildren2 = baseItemDisplay.GetComponentsInChildren<Renderer>(true);
		foreach (Renderer val4 in componentsInChildren2)
		{
			string name = ((Object)val4).name;
			if (name == "HERESY")
			{
				val4.material = Load<Material>("RoR2/Base/Heretic/matHereticBody.mat");
			}
			else if (name == "BOOTS")
			{
				Material val5 = new Material(Load<Material>("RoR2/DLC1/TreasureCacheVoid/matLockboxVoidRocks.mat"));
				val5.SetTexture("_NormalTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/TiledTextures/texNormalBumpyRock.jpg"));
				val5.SetFloat("_NormalStrength", 1f);
				val5.SetFloat("_Cull", 0f);
				val4.material = val5;
			}
			else
			{
				val4.material = Utils.InstantiateMaterial(val4.material.mainTexture);
			}
			((Component)val4).gameObject.SetActive(false);
		}
		ChildLocator component = baseItemDisplay.GetComponent<ChildLocator>();
		ModelPanelParameters val6 = baseItemDisplay.AddComponent<ModelPanelParameters>();
		val6.focusPointTransform = component.FindChild("FocusPoint");
		val6.cameraPositionTransform = component.FindChild("CameraPosition");
		string text = "SCALPEL";
		scalpel = NewItemDef(text, NewItemPrefab(text), (ItemTier)0);
		LanguageAPI.Add("BENTO_" + text + "_NAME", "Scalpel");
		LanguageAPI.Add("BENTO_" + text + "_DESCRIPTION", "Gain <style=cIsDamage>5%</style> <style=cStack>(+5% per stack)</style> chance to <style=cIsDamage>critically strike</style> and <style=cIsDamage>5%</style> <style=cStack>(+5% per stack)</style> chance to <style=cIsDamage>bleed</style>.");
		LanguageAPI.Add("BENTO_" + text + "_PICKUP", "Gain crit chance and bleed on hit.");
		LanguageAPI.Add("BENTO_" + text + "_LORE", "I don't know why or how it's possible, but whenever I hold this, I get the urge to mutilate and desecrate the inhabitants of this planet?\n\nPerhaps this is a reminder that deep down we don't belong here, that we are the true monsters of this planet!");
		text = "BOOK";
		book = NewItemDef(text, NewItemPrefab(text), (ItemTier)1);
		LanguageAPI.Add("BENTO_" + text + "_NAME", "Blank Book");
		LanguageAPI.Add("BENTO_" + text + "_DESCRIPTION", "Activating an interactable or pickup <style=cIsUtility>reduces equipment cooldown</style> by <style=cIsUtility>4s</style> <style=cStack>(+4s per stack)</style>.");
		LanguageAPI.Add("BENTO_" + text + "_PICKUP", "Equipment cooldown is reduced when activating interactables and pickups.");
		LanguageAPI.Add("BENTO_" + text + "_LORE", "I've tried everything to make use of this book, but no matter how many times I write my name or spill coffee on the pages they always disappear within seconds!\n\nEven when I rip out the pages they magically regenerate in the book. Perhaps I'm missing something, or perhaps this whole thing is just designed to ragebait the gullible and ill tempered for the amusement of others!");
		text = "BOOTS";
		boots = NewItemDef(text, NewItemPrefab(text), (ItemTier)2);
		LanguageAPI.Add("BENTO_" + text + "_NAME", "Stone Boots");
		LanguageAPI.Add("BENTO_" + text + "_DESCRIPTION", "Gain <style=cIsDamage>50% damage</style> <style=cStack>(+50% per stack)</style> and increases <style=cIsHealing>healing received</style> by <style=cIsHealing>50%</style> <style=cStack>(+50% per stack)</style>.");
		LanguageAPI.Add("BENTO_" + text + "_PICKUP", "Gain damage and increased healing.");
		LanguageAPI.Add("BENTO_" + text + "_LORE", "At first they all Laughed at me for wearing them! Told me it would slow me down and make me look like a twat for sculpting a pair of boots out of the stone ore!\n\nBut when my fist caved in the skull of a Lemurian in a single punch, that's when they stopped laughing. My injuries from its bite even healed faster then usual with the Medkit.\n\nThe only problem now is they tasked me with sculpting more of these boots for everyone else. At least they say thanks for every pair I finish.");
		text = "LETTICE";
		lettice = NewEquip(text, NewItemPrefab(text), 75f);
		LanguageAPI.Add("BENTO_" + text + "_NAME", "Lucky Lad's Lettice");
		LanguageAPI.Add("BENTO_" + text + "_DESCRIPTION", " ");
		LanguageAPI.Add("BENTO_" + text + "_PICKUP", "Gain luck.");
		LanguageAPI.Add("BENTO_" + text + "_LORE", "For some unknown reason, the heads of Lettice grown on Petrichor V grant an increase of luck to those who are holding them on their person, and even bestow brief strokes of unfathomable luck to those who eat the leaves. Because of this they are strictly banned from being brought into or eaten before entering the poker room.");
		text = "FEMUR";
		femur = NewItemDef(text, NewItemPrefab(text), (ItemTier)3);
		LanguageAPI.Add("BENTO_" + text + "_NAME", "Fragile Femur");
		LanguageAPI.Add("BENTO_" + text + "_DESCRIPTION", "Gain <style=cIsUtility>75% movement speed</style> <style=cStack>(+75% per stack)</style>, and increase <style=cIsHealth>damage taken</style> by <style=cIsHealth>50%</style> <style=cStack>(+50% per stack)</style>.");
		LanguageAPI.Add("BENTO_" + text + "_PICKUP", "Increase movement speed and damage received.");
		LanguageAPI.Add("BENTO_" + text + "_LORE", "Ever Since you Departed Dear Brother, I've Felt a Sense of something Missing from who I once was. Maybe it's my compassion, maybe it's my hope. But one thing's for certain, you were too careless. You were too weak to survive alone, you were a Fool to banish me here and now the price is paid!\n\n<style=cStack>(edited)Wednesday, 4 February 2026 12:59 pm</style>.");
		text = "TROPHY";
		trophy = NewEquip(text, NewItemPrefab(text), 25f, isLunar: true);
		LanguageAPI.Add("BENTO_" + text + "_NAME", "Heretical Trophy");
		LanguageAPI.Add("BENTO_" + text + "_DESCRIPTION", "Receive <style=cIsUtility>1</style> of every Heresy item missing. Add <style=cIsUtility>20 Ruin</style> stacks to every enemy in a <style=cIsDamage>90m</style> radius.");
		LanguageAPI.Add("BENTO_" + text + "_PICKUP", "Gain items of heresy and inflict ruin to nearby enemies.");
		LanguageAPI.Add("BENTO_" + text + "_LORE", "The voices claw inside my head whenever I'm near this damn thing, demanding me to reject my old form and become anew. Some of my comrades have turned into these unrecognizable bird like beings.\n\nI can't tell what's worse between their incomprehensible squawking, their violent bloodlust for the inhabitants of this planet, or the fact they keep putting this thing right up in my face!");
	}

	internal static GameObject NewItemPrefab(string name)
	{
		GameObject val = Instantiate(baseItemDisplay, name);
		((Component)val.GetComponent<ChildLocator>().FindChild(name)).gameObject.SetActive(true);
		return val;
	}

	internal static EquipmentDef NewEquip(string name, GameObject pickupModelPrefab, float cooldown, bool isLunar = false, bool canDrop = true)
	{
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		EquipmentDef val = ScriptableObject.CreateInstance<EquipmentDef>();
		((Object)val).name = "BENTO_" + name;
		val.nameToken = "BENTO_" + name + "_NAME";
		val.descriptionToken = "BENTO_" + name + "_DESCRIPTION";
		val.pickupToken = "BENTO_" + name + "_PICKUP";
		val.loreToken = "BENTO_" + name + "_LORE";
		val.pickupIconSprite = Assets.Load<Sprite>(name);
		val.pickupModelPrefab = pickupModelPrefab;
		val.unlockableDef = null;
		val.appearsInSinglePlayer = true;
		val.appearsInMultiPlayer = true;
		val.canBeRandomlyTriggered = true;
		val.canDrop = canDrop;
		val.canBeRandomlyTriggered = canDrop;
		val.cooldown = cooldown;
		val.enigmaCompatible = true;
		val.isBoss = false;
		val.isLunar = isLunar;
		val.colorIndex = (ColorIndex)(isLunar ? 4 : 5);
		ContentAddition.AddEquipmentDef(val);
		return val;
	}

	internal static ItemDef NewItemDef(string name, GameObject pickupModelPrefab, ItemTier tier, params ItemTag[] tags)
	{
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		ItemDef val = ScriptableObject.CreateInstance<ItemDef>();
		((Object)val).name = "BENTO_" + name;
		val.nameToken = "BENTO_" + name + "_NAME";
		val.descriptionToken = "BENTO_" + name + "_DESCRIPTION";
		val.pickupToken = "BENTO_" + name + "_PICKUP";
		val.loreToken = "BENTO_" + name + "_LORE";
		val.pickupIconSprite = Assets.Load<Sprite>(name);
		val.pickupModelPrefab = pickupModelPrefab;
		val.deprecatedTier = tier;
		val.tier = tier;
		val.tags = tags;
		ContentAddition.AddItemDef(val);
		return val;
	}

	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 class Extensions
{
	public static void AddItemIfNotPresent(this Inventory inventory, ItemDef itemDef)
	{
		if (inventory.GetItemCountEffective(itemDef) == 0)
		{
			inventory.GiveItemPermanent(itemDef, 1);
		}
	}

	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 int CalculateItemBonus(int float1, int float1Stack, int itemCount)
	{
		return float1 + float1Stack * (itemCount - 1);
	}

	public static float CalculateItemBonus(float float1, float float1Stack, int itemCount)
	{
		return float1 + float1Stack * (float)(itemCount - 1);
	}

	internal static void RecolorEffect(GameObject obj, Color color)
	{
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)obj))
		{
			return;
		}
		OmniEffect component = obj.GetComponent<OmniEffect>();
		if (Object.op_Implicit((Object)(object)component))
		{
			Object.DestroyImmediate((Object)(object)obj.GetComponent<OmniEffect>());
		}
		Renderer[] componentsInChildren = obj.GetComponentsInChildren<Renderer>(Object.op_Implicit((Object)(object)component));
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			((Component)componentsInChildren[i]).gameObject.SetActive(true);
			if (Object.op_Implicit((Object)(object)componentsInChildren[i].material) && componentsInChildren[i].material.HasProperty("_TintColor"))
			{
				componentsInChildren[i].material.SetColor("_TintColor", color);
			}
		}
	}

	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_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Expected O, but got Unknown
		GameObject val = PrefabAPI.InstantiateClone(model, name, false);
		Animator componentInChildren = val.GetComponentInChildren<Animator>();
		componentInChildren.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.Contains(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;
	}
}